Beispiel #1
0
        // 拷贝一个PlayModeInfo
        private static void copyInfo(PlayModeInfo info)
        {
            if (info == null)
            {
                return;
            }

            copyData = new PlayModeInfo();
            copyData.CloneTarget(info);
        }
Beispiel #2
0
        // 将当前拷贝的PlayModeInfo 赋值给传入的info
        private static void pasteInfo(PlayModeInfo info)
        {
            if (copyData == null)
            {
                Debug.LogError("当前拷贝的PlayModeInfo为Null,无法完成复制!");
                return;
            }

            if (!Directory.Exists(Application.dataPath + "/Scripts/Editor/PlayMode/backUp"))
            {
                Directory.CreateDirectory(Application.dataPath + "/Scripts/Editor/PlayMode/backUp");
            }

            File.Copy(dataPath, backupPath);
            UnityEditor.AssetDatabase.SaveAssets();
            UnityEditor.AssetDatabase.Refresh();

            info.CloneTarget(copyData);

            copyData = null;
        }
Beispiel #3
0
        private PublicConfig()
        {
            config.key       = 1;
            config.isOpen    = false;
            config.value     = "大众玩法";
            config.showIndex = 1;
            List <PlayModeInfo> copyList = new List <PlayModeInfo>();

            if (PlayModeTools.data.configs.Count > 0 && PlayModeTools.data.configs[0].configs[0].playModeList.Count > 0)
            {
                List <PlayModeInfo> playModeList = PlayModeTools.data.configs[0].configs[0].playModeList;
                for (int i = 0; i < playModeList.Count; i++)
                {
                    PlayModeInfo info = new PlayModeInfo();
                    info.gameId    = playModeList[i].gameId;
                    info.location  = playModeList[i].location;
                    info.showIndex = playModeList[i].showIndex;
                    info.CloneTarget(playModeList[i]);
                    info.isOpen = false;
                    copyList.Add(info);
                }
            }

            copyList.Sort((a, b) => {
                if (a.gameId > b.gameId)
                {
                    return(1);
                }
                else if (a.gameId == b.gameId)
                {
                    return(-1);
                }
                else
                {
                    return(-1);
                }
            });
            config.playModeList = copyList;
        }