public static void OpenWindow() { _ai = null; behaviour = -1; gameConfig = Resources.Load("Configs/GeneralConfigs") as SimpleAIConfig; SimpleAIWindow window = (SimpleAIWindow)GetWindow(typeof(SimpleAIWindow)); window.minSize = windowSize; window.Show(); }
public static void OpenWindow(AI ai, int behaviour_id) { _ai = ai; behaviour = behaviour_id; moment = windowMoments.main; gameConfig = Resources.Load("Configs/GeneralConfigs") as SimpleAIConfig; SimpleAIWindow window = (SimpleAIWindow)GetWindow(typeof(SimpleAIWindow)); window.minSize = windowSize; window.Show(); }
public static void DrawAIActions(AI _ai, SimpleAIConfig gameConfig) { for (int i = 0; i < _ai.actions.Length; i++) { try { EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); Rect r = EditorGUILayout.GetControlRect(); r.height = 22; r.y += 1; GUIStyle style = new GUIStyle(GUI.skin.GetStyle("HelpBox")); style.richText = true; style.normal.textColor = _ai.actions[i].color; style.fontSize = 13; EditorGUI.LabelField(r, "<b>" + _ai.actions[i].name + "</b>", style); if (GUILayout.Button("Edit", new GUILayoutOption[] { GUILayout.Width(50), GUILayout.Height(21) })) { SimpleAIWindow.OpenWindow(_ai, i); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); _ai.actions[i].relevance = EditorGUILayout.IntSlider("Relevance", _ai.actions[i].relevance, 1, 10); EditorGUILayout.EndVertical(); } catch (Exception e) { Debug.LogError(e.Message); continue; } } }
public static void BehavioursTemplate(AI _ai, SimpleAIConfig gameConfig) { EditorGUILayout.LabelField(Language.numberOfBehaviours(gameConfig.selectedLanguage), EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-")) { if (_ai.actions.Length > 0) { Array.Resize <AIAction>(ref _ai.actions, _ai.actions.Length - 1); _ai.save(); } } GUIStyle BoxNumberCenterStyle; BoxNumberCenterStyle = new GUIStyle(); BoxNumberCenterStyle.alignment = TextAnchor.MiddleCenter; BoxNumberCenterStyle.fontStyle = FontStyle.Bold; GUILayout.Box(_ai.actions.Length.ToString(), BoxNumberCenterStyle); if (GUILayout.Button("+")) { Array.Resize <AIAction>(ref _ai.actions, _ai.actions.Length + 1); _ai.actions[_ai.actions.Length - 1] = new AIAction(); _ai.save(); SimpleAIWindow.OpenWindow(_ai, _ai.actions.Length); } EditorGUILayout.EndHorizontal(); GUILayout.Space(2f); DrawAIActions(_ai, gameConfig); }