/// <summary> /// Inits parts of control. /// </summary> private void _InitParts() { _topLevelGrid = this.GetTemplateChild("PART_TopLevelGrid") as Grid; _cellLabel = this.GetTemplateChild("PART_CellLabel") as TextBlock; _openButton = this.GetTemplateChild("PART_OpenButton") as ToggleButton; _popupPanel = this.GetTemplateChild("PART_PopupPanel") as Popup; _barrierEditor = this.GetTemplateChild("PART_BarrierEditor") as BarrierEditor; _textBlock = this.GetTemplateChild("PART_TextBox") as TextBlock; _border = this.GetTemplateChild("PART_Border") as Border; }
public override void Draw(int aID) { GUILayout.BeginArea(tableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("Barrier.Title"), GUILayout.Width(windowWidth * 0.45f)); GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.45f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriersList().Count; i++) { if (i == selectedArea) { GUI.skin = selectedAreaSkin; } GUILayout.BeginHorizontal(); if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriersList()[i].getId(), GUILayout.Width(windowWidth * 0.44f))) { selectedArea = i; } if (GUILayout.Button(conditionTex, GUILayout.Width(windowWidth * 0.44f))) { selectedArea = i; ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriersList()[i].getConditions()); } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth))) { BarrierNewName window = (BarrierNewName)ScriptableObject.CreateInstance(typeof(BarrierNewName)); window.Init(this, "IdBarrier"); } if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriers()[selectedArea]); } if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList() .moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriers()[selectedArea]); } if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList() .moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriers()[selectedArea]); } if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].getBarriersList().getBarriers()[selectedArea], false); } GUI.skin = defaultSkin; GUILayout.EndArea(); if (backgroundPath != "") { GUILayout.BeginArea(infoPreviewRect); // Show preview dialog if (GUILayout.Button(TC.get("DefaultClickAction.ShowDetails") + "/" + TC.get("GeneralText.Edit"))) { // BarrierEditor window = (BarrierEditor)ScriptableObject.CreateInstance(typeof(BarrierEditor)); window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex], selectedArea); } GUILayout.EndArea(); GUI.DrawTexture(previewRect, backgroundPreviewTex, ScaleMode.ScaleToFit); } else { GUILayout.BeginArea(infoPreviewRect); GUILayout.Button("No background!"); GUILayout.EndArea(); } }