Beispiel #1
0
    private static void AfterInject(AssemblyDefinition ad)
    {
        string unityEditorPath = typeof(AssetDatabase).Module.FullyQualifiedName;
        string path            = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UnityEditor.dll");

        if (File.Exists(path))
        {
            File.Delete(path);
        }
        ad.Write(path);
        try
        {
            string dest = Path.Combine(Path.GetDirectoryName(Application.dataPath), "Library/UnityAssemblies/");
            File.Copy(path, dest + "UnityEditor.dll");
            File.Copy(path, unityEditorPath, true);
        }
        catch (Exception e)
        {
            XDebug.LogWarning(e.Message);
            if (EditorUtility.DisplayDialog("Error", "move folder error. move folder manually please!", "OK"))
            {
                HelperEditor.Open(unityEditorPath);
                HelperEditor.Open(path);
            }
        }
        if (EditorUtility.DisplayDialog("Inject", "UnityEditor.dll Inject Finish, restart your Unity, Yes or Not", "OK", "NO"))
        {
            SetSccriptDefine();
            RestartUnity();
        }
    }
Beispiel #2
0
        public static void Model2Image()
        {
            XEditorUtil.SetupEnv();
            string   file = EditorUtility.OpenFilePanel("Select model file", MODEL, "bytes");
            FileInfo info = new FileInfo(file);

            ProcessFile(info);
            HelperEditor.Open(EXPORT);
        }
Beispiel #3
0
        private static void MoveDestDir(string pattern, string sub)
        {
            var path = EXPORT + sub;

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);
            DirectoryInfo dir   = new DirectoryInfo(EXPORT);
            var           files = dir.GetFiles(pattern);

            for (int i = 0; i < files.Length; i++)
            {
                files[i].MoveTo(path + files[i].Name);
            }
            HelperEditor.Open(path);
        }
Beispiel #4
0
    public static void Build(bool fast)
    {
        _scenes = FindEnabledEditorScenes();
        EditorUserBuildSettings.SwitchActiveBuildTarget(_target);
        if (Directory.Exists(_targetDir))
        {
            try { Directory.Delete(_targetDir, true); }
            catch (System.Exception e) { XDebug.Log(e.Message); }
        }
        Directory.CreateDirectory(_targetDir);

        if (!fast)
        {
            XPriorBuild.OnPriorBuild(fast, EditorUserBuildSettings.activeBuildTarget);
        }
        string lastName = "";

        if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
        {
            lastName = ".apk";
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows)
        {
            lastName = ".exe";
        }
        string dest = Path.Combine(_targetDir, "dnasset" + lastName);
        string res  = BuildPipeline.BuildPlayer(_scenes, dest, _target, _build);

        string macro = XBuild.Macro;

        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, macro);
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, macro);
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, macro);
        if (!fast)
        {
            XPostBuild.OnPostBuild(fast, EditorUserBuildSettings.activeBuildTarget);
        }
        EditorUtility.DisplayDialog("Package Build Finish", "Package Build Finish!(" + res + ")", "OK");
        HelperEditor.Open(_targetDir);
    }
Beispiel #5
0
    public void OnGUI()
    {
        GUI.Label(mWelcomeIntroRect, mWelComeText);
        GUI.DrawTexture(mUIImageRect, mUIImage);
        GUI.Label(mUIHeaderRect, mUITitle);
        GUI.Label(mUIDescriptionRect, mUIContent);
        GUI.DrawTexture(mLevelImageRect, mLevelImage);
        GUI.Label(mLevelHeaderRect, mLevelTitle);
        GUI.Label(mLevelDescriptionRect, mLevelContent);
        GUI.DrawTexture(mSkillImageRect, mSkillImage);
        GUI.Label(mSkillHeaderRect, mSkillTitle);
        GUI.Label(mSkillDescriptionRect, mSkillContent);
        GUI.DrawTexture(mAIImageRect, mAIImage);
        GUI.Label(mAIHeaderRect, mAITitle);
        GUI.Label(mAIDescriptionRect, mAIContent);
        GUI.DrawTexture(mCutsceneImageRect, mCutSceneImage);
        GUI.Label(mCutsceneHeaderRect, mCutsceTitle);
        GUI.Label(mCutsceneDescriptionRect, mCutsceContent);
        GUI.Label(mVersionRect, mDriverText);

        flag = GUI.Toggle(mToggleButtonRect, flag, mStartText);
        PlayerPrefs.SetInt("ShowWelcomeScreen", flag ? 1 : 0);

        EditorGUIUtility.AddCursorRect(mUIImageRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mUIHeaderRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mUIDescriptionRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mLevelImageRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mLevelHeaderRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mLevelDescriptionRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mSkillImageRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mSkillHeaderRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mSkillDescriptionRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mAIImageRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mAIHeaderRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mAIDescriptionRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mCutsceneImageRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mCutsceneHeaderRect, MouseCursor.Link);
        EditorGUIUtility.AddCursorRect(mCutsceneDescriptionRect, MouseCursor.Link);

        if (Event.current.type == EventType.MouseUp)
        {
            Vector2 mousePosition = Event.current.mousePosition; if ((mLevelImageRect.Contains(mousePosition) || mLevelHeaderRect.Contains(mousePosition)) || mLevelDescriptionRect.Contains(mousePosition))
            {
                GetWindow(typeof(LevelEditor));
            }
            else if ((mUIImageRect.Contains(mousePosition) || mUIHeaderRect.Contains(mousePosition)) || mUIDescriptionRect.Contains(mousePosition))
            {
                string path = Path.Combine(Application.dataPath, "Resources/UI");
                HelperEditor.Open(path);
            }
            else if ((mSkillImageRect.Contains(mousePosition) || mSkillHeaderRect.Contains(mousePosition)) || mSkillDescriptionRect.Contains(mousePosition))
            {
                EditorApplication.ExecuteMenuItem("XEditor/Open Skill");
            }
            else if ((mAIImageRect.Contains(mousePosition) || mAIHeaderRect.Contains(mousePosition)) || mAIDescriptionRect.Contains(mousePosition))
            {
                EditorApplication.ExecuteMenuItem("Tools/Behavior Designer/Editor");
            }
            else if ((mCutsceneImageRect.Contains(mousePosition) || mCutsceneHeaderRect.Contains(mousePosition)) || mCutsceneDescriptionRect.Contains(mousePosition))
            {
                EditorApplication.ExecuteMenuItem("XEditor/Cut Scene");
            }
        }
    }