public override SpawnerOutput ReturnCustomUI(int variable, RuntimeParameters rp) { if (variable == GetVariableId("Input Key")) { KeyCodeDropdownList kcDdL = new KeyCodeDropdownList((rp as RuntimeParameters <int>).v); kcDdL.ReturnDropdownWrapper().dropdown.onValueChanged.AddListener((v) => { (rp as RuntimeParameters <int>).v = KeyCodeDropdownList.inputValues[v]; }); return(kcDdL.dW); } return(base.ReturnCustomUI(variable, rp)); }
void Start() { string cData = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 0); string wData = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 2); if (cData != "") { abilityData = new UIAbilityData(LoadedData.GetSingleton <JSONFileConvertor>().ConvertToData(JsonConvert.DeserializeObject <StandardJSONFileFormat[]>(cData)), JsonConvert.DeserializeObject <float[][]>(wData)); } else { abilityData = new UIAbilityData(); } abilityWindows = new AutoPopulationList <EditableWindow>(); lineData = new AutoPopulationList <LineData>(); SpawnUIFromData(); mainClassSelection = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(LinearLayout)); SpawnerOutput name = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(InputFieldWrapper)); name.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.5f, 0.9f)); InputField castedName = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <InputField>(name); string data = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 1); abilityDescription = JsonConvert.DeserializeObject <AbilityInfo>(data); castedName.text = abilityDescription.n; castedName.onValueChanged.AddListener((s) => { abilityDescription.n = s; }); SpawnerOutput[] buttons = new SpawnerOutput[LoadedData.loadedNodeInstance.Count]; foreach (KeyValuePair <Type, AbilityTreeNode> entry in LoadedData.loadedNodeInstance) { SpawnerOutput button = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)); Button butInst = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(button); // Need another way to get elements within spawner output... LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(button, "Text").text = entry.Key.Name; butInst.onClick.AddListener(() => { selectedType = entry.Key; windowSpawner.script.gameObject.SetActive(true); mMode = MouseMode.CREATE_NODE; }); (mainClassSelection.script as LinearLayout).Add(butInst.transform as RectTransform); } classSelectionScrollRect = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ScrollRectWrapper)); (classSelectionScrollRect.script as ScrollRectWrapper).ChangeScrollRectSize(new Vector2(100, 600)); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <UIMule>(classSelectionScrollRect, "Content").GetRectTransform().sizeDelta = (mainClassSelection.script.transform as RectTransform).sizeDelta; classSelectionScrollRect.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.6f)); mainClassSelection.script.transform.SetParent(LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <UIMule>(classSelectionScrollRect, "Content").transform); mainClassSelection.script.transform.localPosition = new Vector2(-(mainClassSelection.script.transform as RectTransform).sizeDelta.x / 2, 0); windowSpawner = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)); windowSpawner.script.gameObject.SetActive(false); SpawnerOutput optLL = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(LinearLayout)); SpawnerOutput normConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(normConnButt, "Text").text = "Normal Conection"; LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(normConnButt, "Image").color = Color.green; LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(normConnButt).onClick.AddListener(() => { mMode = MouseMode.EDIT_CONN; lMode = LinkMode.NORMAL; }); SpawnerOutput sigConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(sigConnButt, "Text").text = "Signal Conection"; LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(sigConnButt, "Image").color = Color.red; LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(sigConnButt).onClick.AddListener(() => { mMode = MouseMode.EDIT_CONN; lMode = LinkMode.SIGNAL; }); SpawnerOutput rmConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(rmConnButt,"Text").text = "Remove Conection"; LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(rmConnButt).onClick.AddListener(() => { mMode = MouseMode.REMOVE_CONN; }); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(normConnButt.script.transform as RectTransform); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(sigConnButt.script.transform as RectTransform); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(rmConnButt.script.transform as RectTransform); optLL.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.9f,0.9f)); SpawnerOutput saveButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(saveButton).onClick.AddListener(() => { int[] aEle = abilityData.subclasses.ReturnActiveElementIndex(); AbilityDataSubclass[] cAD = abilityData.RelinkSubclass(); string[] imgDependencies = AbilityDataSubclass.GetImageDependencies(cAD); // Gets all window locations. float[][] windowLocations = new float[cAD.Length][]; for (int i = 0; i < windowLocations.Length; i++) { windowLocations[i] = new float[2]; windowLocations[i][0] = abilityWindows.l[aEle[i]].transform.position.x; windowLocations[i][1] = abilityWindows.l[aEle[i]].transform.position.y; } FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility },0,JsonConvert.SerializeObject(LoadedData.GetSingleton <JSONFileConvertor>().ConvertToStandard(cAD))); FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 1, JsonConvert.SerializeObject(abilityDescription)); FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 2, JsonConvert.SerializeObject(windowLocations)); FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 3, JsonConvert.SerializeObject(imgDependencies)); }); LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(saveButton, "Text").text = "Save JSON"; saveButton.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.5f, 0.1f)); // Creates dropdown for input. kcDdL = new KeyCodeDropdownList(abilityDescription.kC); kcDdL.ReturnDropdownWrapper().transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.75f, 0.9f)); kcDdL.ReturnDropdownWrapper().dropdown.onValueChanged.AddListener((v) => { abilityDescription.kC = KeyCodeDropdownList.inputValues[v]; }); // Creates dropdown for startnode. //DropdownWrapper sNDW = LoadedData.GetSingleton<UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper)).script as DropdownWrapper; ButtonWrapper addOptionsButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper; addOptionsButton.button.onClick.AddListener(() => CreateWindowForAdditionalOptions()); addOptionsButton.text.text = "Additional Options"; addOptionsButton.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.2f)); ButtonWrapper exitBlueprintMaker = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper; exitBlueprintMaker.button.onClick.AddListener(() => SceneTransitionData.LoadScene("AbilityPage")); exitBlueprintMaker.text.text = "Exit"; exitBlueprintMaker.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.1f)); }