void OnGUI()
 {
     if (roamingCursor.activeInHierarchy)
     {
         GUIExtended.Label(new Rect((Screen.width - 100) / 2, Screen.height * 0.75f, 100, 100), "Choose Location", new GUIStyle(GUI.skin.label), Color.black, Color.white);
     }
 }
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 22;
        style.alignment = TextAnchor.UpperRight;

        string title = mode == 0 ? "Your Scores" : "Top Scores";

        GUI.BeginGroup(new Rect(Screen.width - 210, 10, 200, 300));

        GUIExtended.Label(new Rect(0, 0, 200, 50), title, style, Color.black, Color.white);

        if (mode == 0)
        {
            ShowYourScores();
        }
        else
        {
            ShowTopScores();
        }

        GUI.EndGroup();
    }
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font     = skin.font;
        style.fontSize = 18;

        GUIExtended.Label(new Rect(130, 10, 200, 50), playerList.Count + " Player(s) Online", style, Color.black, Color.white);
    }
Beispiel #4
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width - 150 - 20, 10, 150, 70), GUI.skin.box);

        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIExtended.Label(new Rect(-10, 10, 150, 50), credits.ToString("n0") + " Credits", style, Color.black, Color.green);

        style           = new GUIStyle(skin.label);
        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIExtended.Label(new Rect(-10, 30, 150, 50), coins.ToString("n0") + " Coins", style, Color.black, Color.yellow);

        GUI.EndGroup();

        if (GUI.Button(new Rect(Screen.width - 170, 90, 150, 30), "Top 3 players"))
        {
            showTopListDialog = true;
        }

        if (showTopListDialog)
        {
            GUI.BeginGroup(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 100, 300, 200), GUI.skin.box);

            style.font      = skin.font;
            style.fontSize  = 20;
            style.alignment = TextAnchor.UpperCenter;

            GUIExtended.Label(new Rect(20, 10, 250, 50), " Top players ranking", style, Color.black, Color.white);

            style.fontSize  = 15;
            style.alignment = TextAnchor.UpperCenter;

            getTopPlayers();

            GUIExtended.Label(new Rect(10, 50, 250, 50), topPlayerNames[0] + "\t" + topPlayerScores[0], style, Color.black, Color.white);
            GUIExtended.Label(new Rect(10, 100, 250, 50), topPlayerNames[1] + "\t" + topPlayerScores[1], style, Color.black, Color.white);
            GUIExtended.Label(new Rect(10, 150, 250, 50), topPlayerNames[2] + "\t" + topPlayerScores[2], style, Color.black, Color.white);

            GUI.EndGroup();
        }

        if (Input.GetKeyDown("return") || Input.GetMouseButtonDown(0))
        {
            showTopListDialog = false;
        }
    }
    void OnGUI()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperCenter;

        GUI.BeginGroup(new Rect(Screen.width / 2 - 75, 10, 150, 150));
        GUIExtended.Label(new Rect(0, 0, 150, 50), DateTimeFormatInfo.CurrentInfo.GetMonthName(month), style, Color.black, Color.white);
        GUIExtended.Label(new Rect(0, 25, 150, 50), "Day " + day, style, Color.black, Color.white);
        GUI.EndGroup();
    }
Beispiel #6
0
	void OnGUI() {
				if (!isBeHidden) {
						height = PlayerList.Count * 20;
						GUIStyle style = new GUIStyle(skin.label);
						style.font = skin.font;
						style.fontSize = 18;
						style.alignment = TextAnchor.UpperLeft;
						Color32 color = new Color32();;

						windowRect = new Rect(25, 10, 150, 200);
						if (GUI.Button(new Rect(25, 210, 50, 30), "Close")) {
							mainObject.GetComponent<PlayerList>().Show();
							Destroy(this);
						}
				Color temp = GUI.color;
				GUI.Box(new Rect(25, 10, 150, 200), "Player List");
				scrollPosition = GUI.BeginScrollView(new Rect(25, 30, 150, 175), scrollPosition, new Rect(25, 30, 130, height));;
				for (int i = 1; i <= PlayerList.Count; i++) {
					
					GUI.BeginGroup (new Rect (27, 22 + (i - 1) * 20, 150, 200));
					var boxStyle = new GUIStyle(GUI.skin.box);
//					if (PlayerList[i].color != 0)
//					{
//						color = PlayerColorList[PlayerList[i].color];
//					}
//					else
//					{
//						color = Color.gray;
//					}
					GUIExtended.Label(new Rect(4, 0, 100, 100), PlayerList[i].name, style, Color.white, color);
					GUI.color = new Color(1.0f,1.0f,1.0f,0.0f);
					if (GUI.Button(new Rect(0, 4, 100, 20), ""))
					{
						var ownerid = PlayerList[i].GetID();
						var ownedtile = map.FindPlayerOwnedTile(ownerid);
						if (ownedtile != null)
						{
							var x = ownedtile.transform.position.x;
							var y = GameObject.Find("MapCamera").transform.position.y;
							var z = ownedtile.transform.position.z - 40;
							Vector3 pos = new Vector3(x, y, z);
							GameObject.Find("MapCamera").transform.position = pos;
						}
					}
					GUI.EndGroup ();
				GUI.color = temp;
				}
				GUI.EndScrollView();
				}	  
		}
    public void ShowTopScores()
    {
        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIStyle scoreStyle = new GUIStyle(skin.label);

        scoreStyle.font      = skin.font;
        scoreStyle.fontSize  = 18;
        scoreStyle.alignment = TextAnchor.UpperRight;

        {
            Rect rect = new Rect(0, 30, 200, 50);
            GUIExtended.Label(rect, "High Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < highScoreList.Length; i++)
            {
                string scoreText = highScoreList[i] == 0 ? "-" : highScoreList[i].ToString("n0");
                GUIExtended.Label(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }

        {
            Rect rect = new Rect(0, 120, 200, 50);
            GUIExtended.Label(rect, "Total Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < totalScoreList.Length; i++)
            {
                string scoreText = totalScoreList[i] == 0 ? "-" : totalScoreList[i].ToString("n0");
                GUIExtended.Label(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }

        {
            Rect rect = new Rect(0, 200, 200, 50);
            GUIExtended.Label(rect, "Current Score", style, Color.black, new Color(1.0f, 0.93f, 0.73f, 1.0f));

            for (int i = 0; i < currentScoreList.Length; i++)
            {
                string scoreText = currentScoreList[i] == 0 ? "-" : currentScoreList[i].ToString("n0");
                GUIExtended.Label(new Rect(rect.x, rect.y + 20 + i * 20, 200, 50), scoreText, scoreStyle, Color.black, Color.white);
            }
        }
    }
Beispiel #8
0
    void OnGUI()
    {
        //GUI.Label (new Rect(300, 0, 200, 50), "Environment Score: " + score );
        GUI.BeginGroup(new Rect(Screen.width / 2 - 100, 60, 200, 100));
        GUIStyle style = new GUIStyle();

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperCenter;

        Color color = new Color(1.0f, 0.93f, 0.73f, 1.0f);

        GUIExtended.Label(new Rect(0, 0, 200, 50), "Ecosystem Score", style, Color.black, color);

        style.fontSize  = 24;
        style.alignment = TextAnchor.UpperCenter;

        GUIExtended.Label(new Rect(0, 25, 200, 50), score.ToString("n0"), style, Color.black, Color.white);
        GUI.EndGroup();
    }
Beispiel #9
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width - 150 - 20, 10, 150, 70), GUI.skin.box);

        GUIStyle style = new GUIStyle(skin.label);

        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIExtended.Label(new Rect(-10, 10, 150, 50), credits.ToString("n0") + " Credits", style, Color.black, Color.green);

        style           = new GUIStyle(skin.label);
        style.font      = skin.font;
        style.fontSize  = 20;
        style.alignment = TextAnchor.UpperRight;

        GUIExtended.Label(new Rect(-10, 30, 150, 50), coins.ToString("n0") + " Coins", style, Color.black, Color.yellow);

        GUI.EndGroup();
    }
Beispiel #10
0
 public override void OnGUI()
 {
     GUIExtended.CollapsibleWithCheck(ref KeyBinding.Collapse, ref KeyBinding.Enabled, "키바인딩 설정", () =>
     {
         KeyMapUI(ref KeyBinding.CLS.instantJoinKey, ref KeyBinding.CLS.instantJoinKeyActive, ref KeyBinding.CLS.instantJoinKeyCollapse, "cls에서 맵 바로 입장");
         KeyMapUI(ref KeyBinding.CLS.workshopKey, ref KeyBinding.CLS.workshopKeyActive, ref KeyBinding.CLS.workshopKeyCollapse, "스팀 창작마당 열기");
         KeyMapUI(ref KeyBinding.CLS.reloadKey, ref KeyBinding.CLS.reloadKeyActive, ref KeyBinding.CLS.reloadKeyCollapse, "CLS 새로고침");
         KeyMapUI(ref KeyBinding.CLS.infoKey, ref KeyBinding.CLS.infoKeyActive, ref KeyBinding.CLS.infoKeyCollapse, "맵 정보 보기");
         KeyMapUI(ref KeyBinding.CLS.editorKey, ref KeyBinding.CLS.editorKeyActive, ref KeyBinding.CLS.editorKeyCollapse, "CLS에서 맵 에디터 바로 입장");
         KeyMapUI(ref KeyBinding.Editor.quitKey, ref KeyBinding.Editor.quitKeyActive, ref KeyBinding.Editor.quitKeyCollapse, "에디터 나가기");
     }, () =>
     {
         if (KeyBinding.Enabled)
         {
             MiscModule.Harmony.PatchConditionalTag(Assembly.GetExecutingAssembly(), "AdofaiUtils2.Misc.KeyBinding");
         }
         else
         {
             MiscModule.Harmony.UnpatchConditionalTag(Assembly.GetExecutingAssembly(), "AdofaiUtils2.Misc.KeyBinding");
         }
     });
 }
Beispiel #11
0
        private void KeyMapUI(ref KeyBinding key, ref bool active, ref bool collapse, string title)
        {
            GUILayout.BeginHorizontal();
            var newActive = GUILayout.Toggle(collapse, active ? collapse ? "▼" : "▶" : "", new GUIStyle
            {
                fixedWidth = 10,
                margin     = new RectOffset(0, 4, 0, 0),
                fontSize   = 15,
                normal     = new GUIStyleState
                {
                    textColor = Color.white
                }
            });
            var newChecked = GUILayout.Toggle(active, title, new GUIStyle(GUI.skin.toggle)
            {
                margin = new RectOffset(0, 4, 0, 0)
            });

            GUILayout.EndHorizontal();
            if (newChecked != active)
            {
                active = newChecked;
                if (!newChecked)
                {
                    collapse = false;
                }
            }
            if (newActive != collapse && newChecked)
            {
                collapse = newActive;
            }
            if (collapse)
            {
                GUIExtended.BeginIndent();
                UnityModManager.UI.DrawKeybinding(ref key, title);
                GUIExtended.EndIndent();
            }
        }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        GUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);
        if (GUILayout.Button("Open Graph"))
        {
            FlowchartEditorWindow.Init(graph);
        }
        EditorGUILayout.PropertyField(serializedObject.FindProperty("symboles"), true);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("connectionPoints"), true);
        GUILayout.EndVertical();
        XmlDictionary <string, VariableTest> renameds = new XmlDictionary <string, VariableTest>();

        foreach (var variable in variables)
        {
            var frect    = EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
            var fboxRect = new Rect(frect.x, frect.y - 1.5f, frect.width + 1, frect.height + 2.5f);
            GUI.Box(fboxRect, "");
            GUI.Button(new Rect(frect.x + 5, frect.center.y - 7.5f, 20, 20), '\u003D'.ToString(), GUIStyle.none);
            var name = variable.Value.name;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            variable.Value.name = EditorGUILayout.TextField(variable.Value.name);
            GUILayout.EndHorizontal();
            var variableType = variable.Value.variableType;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            variable.Value.variableType = (VariableType)EditorGUILayout.EnumPopup(variable.Value.variableType);
            GUILayout.EndHorizontal();
            if (variableType != variable.Value.variableType)
            {
                GUIChanged = true;
            }
            Tuple <bool, object> value = null;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (variable.Value.variableType != VariableType.Object)
            {
                value = GUIExtended.DrawGUISwitch(variable.Value.variableType.ToString(), variable.Value.value);
            }
            else
            {
                value = GUIExtended.DrawGUIUObject(variable.Value.value);
            }
            GUILayout.EndHorizontal();
            if (value != null)
            {
                if (value.Item1 == true)
                {
                    GUIChanged = true;
                }
                variable.Value.value = value.Item2;
            }
            if (name != variable.Value.name)
            {
                renameds.Add(variable.Key, variable.Value);
            }
            EditorGUILayout.EndVertical();
        }
        foreach (var renamed in renameds)
        {
            var index = variables.Values.IndexOf(renamed.Value);
            variables.RemoveAt(index);
            if (variables.Count < index)
            {
                variables.Add(renamed.Key, renamed.Value);
            }
            else
            {
                variables.Insert(index, new XmlKeyValuePair <string, VariableTest>(renamed.Key, renamed.Value));
            }
        }
        var trect    = EditorGUILayout.BeginHorizontal(EditorStyles.inspectorFullWidthMargins);
        var rect     = GUILayoutUtility.GetRect(trect.width, trect.height + 16);
        var tboxRect = new Rect(trect.x, rect.y, trect.width - 30, rect.height);

        TempVariable = EditorGUI.TextField(tboxRect, TempVariable);
        if (GUI.Button(new Rect(trect.width - 30, rect.y, 30, rect.height), '\u002B'.ToString()) && !string.IsNullOrEmpty(TempVariable))
        {
            var variable = new VariableTest();
            variable.name = TempVariable;
            variables.Add(TempVariable, variable);
            TempVariable = string.Empty;
            GUIChanged   = true;
        }
        if (string.IsNullOrEmpty(TempVariable))
        {
            EditorGUI.LabelField(tboxRect, "(New Variable Name)", TempLable());
        }
        EditorGUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("REMOVE"))
        {
            if (variables.Count > 0)
            {
                variables.RemoveAt(variables.IndexOf(variables.Last()));
                GUIChanged = true;
            }
        }
        GUILayout.EndHorizontal();
        if (variables != null && variables.Count > 0)
        {
            SerializeData();
        }
        serializedObject.ApplyModifiedProperties();
    }
 public override void OnInspectorGUI()
 {
     serializedObject.Update();
     //disableMargin = true;
     //UseDefaultMargins();
     flowchart.graph = (VCSUGraph)EditorGUILayout.ObjectField("Graph", flowchart.graph, typeof(VCSUGraph), true);
     if (flowchart.graph)
     {
         if (AssetDatabase.Contains(flowchart.graph))
         {
             flowchart.graph = VCSUObject.Clone(flowchart.graph);
         }
     }
     if (!EditorApplication.isPlaying)
     {
         if (GUILayout.Button("Generate Test Script"))
         {
             var dc = new DynamicClass();
             dc.Import(flowchart.graph);
             dc.Export();
         }
     }
     GUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins);
     if (GUILayout.Button("Open Graph"))
     {
         FlowchartEditorWindow.Init(flowchart.graph);
     }
     if (GUILayout.Button("Revert To Original"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             flowchart.graph = VCSUObject.Clone(oGraph);
         }
     }
     if (GUILayout.Button("Apply To Original Graph"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             VCSUObject.ApplyFromClone(flowchart.graph, oGraph);
         }
     }
     GUILayout.EndHorizontal();
     if (variables != null)
     {
         XmlDictionary <string, VariableTest> renameds = new XmlDictionary <string, VariableTest>();
         foreach (var variable in variables)
         {
             var frect    = EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
             var fboxRect = new Rect(frect.x, frect.y - 1.5f, frect.width + 1, frect.height + 2.5f);
             GUI.Box(fboxRect, "");
             GUI.Button(new Rect(frect.x + 5, frect.center.y - 7.5f, 20, 20), '\u003D'.ToString(), GUIStyle.none);
             var name = variable.Value.name;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.name = EditorGUILayout.TextField(variable.Value.name);
             GUILayout.EndHorizontal();
             var variableType = variable.Value.variableType;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.variableType = (VariableType)EditorGUILayout.EnumPopup(variable.Value.variableType);
             GUILayout.EndHorizontal();
             if (variableType != variable.Value.variableType)
             {
                 GUIChanged = true;
             }
             Tuple <bool, object> value = null;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             if (variable.Value.variableType != VariableType.Object)
             {
                 value = GUIExtended.DrawGUISwitch(variable.Value.variableType.ToString(), variable.Value.value);
             }
             else
             {
                 value = GUIExtended.DrawGUIUObject(variable.Value.value);
             }
             GUILayout.EndHorizontal();
             if (value != null)
             {
                 if (value.Item1 == true)
                 {
                     GUIChanged = true;
                 }
                 variable.Value.value = value.Item2;
             }
             if (name != variable.Value.name)
             {
                 renameds.Add(variable.Key, variable.Value);
             }
             EditorGUILayout.EndVertical();
         }
         foreach (var renamed in renameds)
         {
             var index = variables.Values.IndexOf(renamed.Value);
             variables.RemoveAt(index);
             if (variables.Count < index)
             {
                 variables.Add(renamed.Key, renamed.Value);
             }
             else
             {
                 variables.Insert(index, new XmlKeyValuePair <string, VariableTest>(renamed.Key, renamed.Value));
             }
         }
         var trect    = EditorGUILayout.BeginHorizontal(EditorStyles.inspectorFullWidthMargins);
         var rect     = GUILayoutUtility.GetRect(trect.width, trect.height + 16);
         var tboxRect = new Rect(trect.x, rect.y, trect.width - 30, rect.height);
         TempVariable = EditorGUI.TextField(tboxRect, TempVariable);
         if (GUI.Button(new Rect(trect.width - 30, rect.y, 30, rect.height), '\u002B'.ToString()) && !string.IsNullOrEmpty(TempVariable))
         {
             var variable = new VariableTest();
             variable.name = TempVariable;
             variables.Add(TempVariable, variable);
             TempVariable = string.Empty;
             GUIChanged   = true;
         }
         if (string.IsNullOrEmpty(TempVariable))
         {
             EditorGUI.LabelField(tboxRect, "(New Variable Name)", TempLable());
         }
         EditorGUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("REMOVE"))
         {
             if (variables.Count > 0)
             {
                 variables.RemoveAt(variables.IndexOf(variables.Last()));
                 GUIChanged = true;
             }
         }
         GUILayout.EndHorizontal();
     }
     if (variables != null && variables.Count > 0)
     {
         SerializeData();
     }
     serializedObject.ApplyModifiedProperties();
 }