예제 #1
0
    void OnGUI_Version(AgentSetVersion version)
    {
        GUIStyle version_style;

        EditorGUILayout.LabelField("All Plugins", BoldLabel);
        scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(180));
        for (int i = 0; i < plugins.Agents.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (version.hasPlugin(plugins.Agents[i].filename))
            {
                AgentVersion v = version.getVersionOfPlugin(plugins.Agents[i].filename);
                v.status = EditorGUILayout.Toggle(v.status, GUILayout.MaxWidth(50));
                if (v.status == false)
                {
                    version_style = NormalLabel;
                }
                else
                {
                    {
                        if (v.isVersionReady(version))
                        {
                            if (v.isManifestReady(manifest) && v.isStringsReady(exist_strings))
                            {
                                version_style = GreenLabel;
                            }
                            else
                            {
                                version_style = YellowLabel;
                            }
                        }
                        else
                        {
                            version_style = RedLabel;
                        }
                    }
                }
            }
            else
            {
                bool status = EditorGUILayout.Toggle(false, GUILayout.MaxWidth(50));
                if (status == true)
                {
                    version.addPlugin().ImportFromManifest(plugins.Agents[i], true);
                    version_style = RedLabel;
                }
                else
                {
                    version_style = NormalLabel;
                }
            }
            EditorGUILayout.LabelField(plugins.Agents[i].filename, version_style);
            if (GUILayout.Button("...", PositiveButton))
            {
                agent = plugins.Agents[i];
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
    }
 void OnGUI_Version(AgentSetVersion version)
 {
     GUIStyle version_style;
     EditorGUILayout.LabelField("All Plugins", BoldLabel);
     scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(180));
     for (int i = 0; i < plugins.Agents.Count; i++)
     {
         EditorGUILayout.BeginHorizontal();
         if (version.hasPlugin(plugins.Agents[i].filename))
         {
             AgentVersion v = version.getVersionOfPlugin(plugins.Agents[i].filename);
             v.status = EditorGUILayout.Toggle(v.status, GUILayout.MaxWidth(50));
             if (v.status == false)
                 version_style = NormalLabel;
             else
             {
                 {
                     if (v.isVersionReady(version))
                     {
                         if (v.isManifestReady(manifest) && v.isStringsReady(exist_strings)) version_style = GreenLabel;
                         else version_style = YellowLabel;
                     } else version_style = RedLabel;
                 }
             }
         } else
         {
             bool status = EditorGUILayout.Toggle(false, GUILayout.MaxWidth(50));
             if (status == true)
             {
                 version.addPlugin().ImportFromManifest(plugins.Agents[i], true);
                 version_style = RedLabel;
             } else
                 version_style = NormalLabel;
         }
         EditorGUILayout.LabelField(plugins.Agents[i].filename, version_style);
         if (GUILayout.Button("...", PositiveButton))
         {
             agent = plugins.Agents[i];
         }
         EditorGUILayout.EndHorizontal();
     }
     EditorGUILayout.EndScrollView();
 }
    private void ApplyVersion(AgentSetVersion v)
    {
        PlayerSettings.bundleVersion = v.versionName;
        PlayerSettings.Android.bundleVersionCode = int.Parse(v.versionCode);
        PlayerSettings.bundleIdentifier = v.bundleid;
        manifest.package = v.bundleid;
        manifest.versionCode = v.versionCode;
        manifest.versionName = v.versionName;

        PreDefinitions = v.PreDefine.ToArray();
        SetPreDefinitions();

        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/res");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/libs");

        foreach (AgentManifest mans in plugins.Agents)
        {
            if (!v.hasPlugin(mans.filename))
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(mans);
            } else if (v.getVersionOfPlugin(mans.filename).status == false)
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(v.getVersionOfPlugin(mans.filename));
            }
        }
        foreach (AgentManifest mans in plugins.Agents)
        {
            if (v.hasPlugin(mans.filename))
            {
                AgentVersion plug = v.getVersionOfPlugin(mans.filename);
                if (plug.status)
                {
                    SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), true);
                    AddPluginDependencies(plug);
                }
            }
        }
        AndroidManifestEditor.SaveManifestToFile(Manifest.ManifestFile, manifest);
        ManifestResource current_strings;
        if (System.IO.File.Exists(ManifestResource.StringsFilename))
            current_strings = StringEditor.LoadResourcesFromFile(ManifestResource.StringsFilename);
        else
            current_strings = new ManifestResource();
        for (int i = 0; i < strings.Count; i++)
        {
            if (current_strings.hasName(strings.strings[i].name))
                current_strings.setValue(strings.strings[i].name, strings.strings[i]);
            else
                current_strings.addString(strings.strings[i].name, strings.strings[i]);
        }
        StringEditor.SaveResourcesToFile(ManifestResource.StringsFilename, current_strings);
        Debug.Log("Done :)");
    }
예제 #4
0
    private void            ApplyVersion(AgentSetVersion v)
    {
        PlayerSettings.bundleVersion             = v.versionName;
        PlayerSettings.Android.bundleVersionCode = int.Parse(v.versionCode);
        PlayerSettings.bundleIdentifier          = v.bundleid;
        manifest.package     = v.bundleid;
        manifest.versionCode = v.versionCode;
        manifest.versionName = v.versionName;

        PreDefinitions = v.PreDefine.ToArray();
        SetPreDefinitions();

        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/res");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/libs");

        foreach (AgentManifest mans in plugins.Agents)
        {
            if (!v.hasPlugin(mans.filename))
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(mans);
            }
            else if (v.getVersionOfPlugin(mans.filename).status == false)
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(v.getVersionOfPlugin(mans.filename));
            }
        }
        foreach (AgentManifest mans in plugins.Agents)
        {
            if (v.hasPlugin(mans.filename))
            {
                AgentVersion plug = v.getVersionOfPlugin(mans.filename);
                if (plug.status)
                {
                    SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), true);
                    AddPluginDependencies(plug);
                }
            }
        }
        AndroidManifestEditor.SaveManifestToFile(Manifest.ManifestFile, manifest);
        ManifestResource current_strings;

        if (System.IO.File.Exists(ManifestResource.StringsFilename))
        {
            current_strings = StringEditor.LoadResourcesFromFile(ManifestResource.StringsFilename);
        }
        else
        {
            current_strings = new ManifestResource();
        }
        for (int i = 0; i < strings.Count; i++)
        {
            if (current_strings.hasName(strings.strings[i].name))
            {
                current_strings.setValue(strings.strings[i].name, strings.strings[i]);
            }
            else
            {
                current_strings.addString(strings.strings[i].name, strings.strings[i]);
            }
        }
        StringEditor.SaveResourcesToFile(ManifestResource.StringsFilename, current_strings);
        Debug.Log("Done :)");
    }