-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from Sandrem/stable-0.3.0
22.11.17 nightly
- Loading branch information
Showing
40 changed files
with
408 additions
and
45 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using Mods; | ||
|
||
public class ModUI : MonoBehaviour { | ||
|
||
public void OnClickModActivationChange(GameObject ModGO) | ||
{ | ||
bool toggleValue = ModGO.transform.Find("Toggle").GetComponent<Toggle>().isOn; | ||
ModsManager.ModToggleIsActive(ModGO.name, toggleValue); | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using Mods; | ||
|
||
public class ModsUI : MonoBehaviour { | ||
|
||
public const float FREE_SPACE = 20f; | ||
|
||
public void Start() | ||
{ | ||
ModsManager.UI = this; | ||
} | ||
|
||
public void InitializePanel() | ||
{ | ||
GameObject prefab = (GameObject)Resources.Load("Prefabs/UI/ModPanel", typeof(GameObject)); | ||
GameObject ModsPanel = GameObject.Find("UI/Panels").transform.Find("ModsPanel").gameObject; | ||
|
||
RectTransform modsPanelRectTransform = ModsPanel.GetComponent<RectTransform>(); | ||
Vector3 currentPosition = new Vector3(ModsPanel.transform.position.x - modsPanelRectTransform.sizeDelta.x/2 + FREE_SPACE, ModsPanel.transform.position.y + modsPanelRectTransform.sizeDelta.y / 2 - FREE_SPACE, ModsPanel.transform.position.z); | ||
|
||
foreach (var mod in ModsManager.Mods) | ||
{ | ||
Transform existingModeRecord = ModsPanel.transform.Find(mod.Key.ToString()); | ||
GameObject ModRecord; | ||
|
||
if (existingModeRecord == null) | ||
{ | ||
ModRecord = MonoBehaviour.Instantiate(prefab, ModsPanel.transform); | ||
ModRecord.transform.position = currentPosition; | ||
ModRecord.name = mod.Key.ToString(); | ||
|
||
ModRecord.transform.Find("Label").GetComponent<Text>().text = mod.Value.Name; | ||
|
||
Text description = ModRecord.transform.Find("Text").GetComponent<Text>(); | ||
description.text = mod.Value.Description; | ||
RectTransform descriptionRectTransform = description.GetComponent<RectTransform>(); | ||
descriptionRectTransform.sizeDelta = new Vector2(descriptionRectTransform.sizeDelta.x, description.preferredHeight); | ||
|
||
RectTransform modRecordRectTransform = ModRecord.GetComponent<RectTransform>(); | ||
modRecordRectTransform.sizeDelta = new Vector2(modRecordRectTransform.sizeDelta.x, modRecordRectTransform.sizeDelta.y + description.preferredHeight); | ||
|
||
currentPosition = new Vector3(currentPosition.x, currentPosition.y - modRecordRectTransform.sizeDelta.y - FREE_SPACE, currentPosition.z); | ||
} | ||
else | ||
{ | ||
ModRecord = existingModeRecord.gameObject; | ||
} | ||
|
||
ModRecord.transform.Find("Toggle").GetComponent<Toggle>().isOn = ModsManager.Mods[mod.Key].IsOn; | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.