예제 #1
0
        private void OnGUI()
        {
            if (isFirst)
            {
                UpdateList();
                isFirst = false;
            }

            UIHelper.ShurikenHeader("EasyAnchorSetup");

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Language");
            Langs.current = (Langs.Language)EditorGUILayout.EnumPopup(Langs.current);
            EditorGUILayout.EndHorizontal();
            showHelp = EditorGUILayout.ToggleLeft("Show help", showHelp);

            if (showHelp)
            {
                EditorGUILayout.HelpBox(Translate.UpdateAvatar(), MessageType.Info);
            }
            if (GUILayout.Button("Update Avtars"))
            {
                UpdateList();
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("AnchorOverride", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();

            scroll = EditorGUILayout.BeginScrollView(scroll);
            if (avatars.Length > 0)
            {
                for (int i = 0; i < avatars.Length; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    try
                    {
                        DrawAvatarList(i);
                    }
                    catch
                    {
                        UpdateList();
                        DrawAvatarList(i);
                    }
                    EditorGUILayout.EndHorizontal();
                }

                if (showHelp)
                {
                    EditorGUILayout.HelpBox(Translate.AnchorNone(), MessageType.Info);
                }
                bool result = CheckAnchor();
                EditorGUILayout.EndScrollView();
                bool btnresult;
                EditorGUI.BeginDisabledGroup(result);
                btnresult = GUILayout.Button("Setup Anchor Override");
                EditorGUI.EndDisabledGroup();
                if (btnresult)
                {
                    ConfirmDialog();
                }
            }
            else
            {
                if (showHelp)
                {
                    EditorGUILayout.HelpBox(Translate.NoDesctiptor(), MessageType.Info);
                }
            }
            UIHelper.ShurikenHeader("About");
            EditorGUILayout.LabelField("Author: AoiKamishiro / 神城アオイ", EditorStyles.boldLabel);

            if (GUILayout.Button("Readme"))
            {
                UIHelper.OpenLink(URL.GIUHUB_REPOS);
            }
            Version.DisplayVersion();
            EditorGUILayout.Space();
        }
예제 #2
0
        private void ConfirmDialog()
        {
            string avtrs = "\n";

            for (int i = 0; i < avatars.Length; i++)
            {
                if (anchors[i] != null)
                {
                    avtrs += "\n" + avatars[i].name;
                }
            }
            bool result = EditorUtility.DisplayDialog("Auto AnchorOverride", Translate.ModAccept() + avtrs, Translate.Continue(), Translate.Cancel());

            if (result)
            {
                SaveScene();
                UpdateAnchors();
                SetSceneDirty();
                UpdateList();
                EditorUtility.DisplayDialog("Auto AnchorOverride", Translate.OperationFin(), "OK");
            }
        }