Example #1
0
        void writeDataToJson()
        {
            JObject         writeJson = new JObject();
            int             index     = 0;
            List <BookData> datas     = new List <BookData>();

            foreach (BookData data in dataMapping.Values)
            {
                datas.Add(data);
            }
            datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            JObject booksOfForbiddenAreaData = new JObject();             //秘境中秘籍静态json数据

            foreach (BookData data in datas)
            {
                data.Skills.Clear();
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                if (booksOfForbiddenAreaData[data.BelongToCityId] == null)
                {
                    booksOfForbiddenAreaData[data.BelongToCityId] = new JArray(data.Id);
                }
                else
                {
                    ((JArray)booksOfForbiddenAreaData[data.BelongToCityId]).Add(data.Id);
                }
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "Books.json", JsonManager.GetInstance().SerializeObject(writeJson));
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "BooksOfForbiddenAreaData.json", JsonManager.GetInstance().SerializeObject(booksOfForbiddenAreaData));
        }
Example #2
0
        void writeDataToJson()
        {
            JObject           writeJson = new JObject();
            int               index     = 0;
            List <WeaponData> datas     = new List <WeaponData>();

            foreach (WeaponData data in dataMapping.Values)
            {
                datas.Add(data);
            }
            datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            JObject weaponBuildingsOfWorkshopData = new JObject();             //工坊兵器锻造静态json数据

            foreach (WeaponData data in datas)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                if (weaponBuildingsOfWorkshopData[data.BelongToCityId] == null)
                {
                    weaponBuildingsOfWorkshopData[data.BelongToCityId] = new JArray(data.Id);
                }
                else
                {
                    ((JArray)weaponBuildingsOfWorkshopData[data.BelongToCityId]).Add(data.Id);
                }
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "Weapons.json", DESStatics.StringEncoder(JsonManager.GetInstance().SerializeObject(writeJson), JsonManager.DecderKey));
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "WeaponIdsOfWorkshopData.json", JsonManager.GetInstance().SerializeObject(weaponBuildingsOfWorkshopData));
        }
Example #3
0
        static void writeDataToJson()
        {
            JObject          writeJson = new JObject();
            int              index     = 0;
            List <EventData> datas     = new List <EventData>();

            foreach (EventData data in dataMapping.Values)
            {
                datas.Add(data);
            }
            datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            JObject cityPosObj = new JObject();             //记录城镇坐标的json表数据

            foreach (EventData data in datas)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                if (data.Type == SceneEventType.EnterCity)
                {
                    if (cityPosObj[data.EventId] == null)
                    {
                        cityPosObj[data.EventId] = data.Id;
                    }
                }
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "AreaEventDatas.json", JsonManager.GetInstance().SerializeObject(writeJson));
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "AreaCityPosDatas.json", JsonManager.GetInstance().SerializeObject(cityPosObj));
            if (areaSizeMapping.ContainsKey(sceneName))
            {
                areaSizeMapping[sceneName].Width  = map.width;
                areaSizeMapping[sceneName].Height = map.height;
            }
            else
            {
                areaSizeMapping.Add(sceneName, new SizeData(sceneName, map.width, map.height));
            }
            JObject sizeObj = new JObject();

            index = 0;
            foreach (SizeData data in areaSizeMapping.Values)
            {
                if (index == 0)
                {
                    index++;
                    sizeObj["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObject(data));
                }
                sizeObj[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObject(data));
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "AreaSizeDatas.json", JsonManager.GetInstance().SerializeObject(sizeObj));
        }
Example #4
0
        void writeDataToJson()
        {
            JObject writeJson = new JObject();
            int     index     = 0;

            foreach (SkillData data in dataMapping.Values)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "Skills.json", DESStatics.StringEncoder(JsonManager.GetInstance().SerializeObject(writeJson), JsonManager.DecderKey));
        }
Example #5
0
        static void OpenWindow()
        {
            TextAsset asset         = Resources.Load <TextAsset>("Data/Json/FirstNames");
            string    firstNamesStr = asset.text.Replace(" ", "|");

            firstNamesStr = firstNamesStr.Replace("\n", "|");
            string[] fen = firstNamesStr.Split(new char[] { '|' });
            if (fen.Length > 0)
            {
                List <string> firstNames = new List <string>();
                for (int i = 0; i < fen.Length; i++)
                {
                    if (!string.IsNullOrEmpty(fen[i]))
                    {
                        firstNames.Add(fen[i]);
                    }
                }
                Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "FirstNamesList.json", JsonManager.GetInstance().SerializeObject(firstNames));
                Debug.LogWarning("创建姓完毕!");
            }

            asset = Resources.Load <TextAsset>("Data/Json/SecondNames");
            string secondNamesStr = asset.text.Replace(" ", "|");

            secondNamesStr = secondNamesStr.Replace("\n", "|");
            string[] fen2 = secondNamesStr.Split(new char[] { '|' });
            if (fen2.Length > 0)
            {
                List <string> secondNames = new List <string>();
                for (int i = 0; i < fen2.Length; i++)
                {
                    if (!string.IsNullOrEmpty(fen2[i]))
                    {
                        secondNames.Add(fen2[i]);
                    }
                }
                Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "SecondNamesList.json", JsonManager.GetInstance().SerializeObject(secondNames));
                Debug.LogWarning("创建名完毕!");
            }
            asset = null;
        }
Example #6
0
        void writeDataToJson()
        {
            JObject         writeJson = new JObject();
            int             index     = 0;
            List <ItemData> datas     = new List <ItemData>();

            foreach (ItemData data in dataMapping.Values)
            {
                datas.Add(data);
            }
            datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            foreach (ItemData data in datas)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "ItemDatas.json", JsonManager.GetInstance().SerializeObject(writeJson));
        }
Example #7
0
        void writeDataToJson()
        {
            JObject         writeJson = new JObject();
            int             index     = 0;
            List <RoleData> datas     = new List <RoleData>();

            foreach (RoleData data in dataMapping.Values)
            {
                datas.Add(data);
            }
            datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            JObject rolesOfWinShopData = new JObject();             //酒馆侠客静态json数据

            foreach (RoleData data in datas)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                if (data.IsStatic)
                {
                    if (rolesOfWinShopData[data.HometownCityId] == null)
                    {
                        rolesOfWinShopData[data.HometownCityId] = new JArray(data.Id);
                    }
                    else
                    {
                        ((JArray)rolesOfWinShopData[data.HometownCityId]).Add(data.Id);
                    }
                }
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "RoleDatas.json", JsonManager.GetInstance().SerializeObject(writeJson));
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "RoleIdsOfWinShopDatas.json", JsonManager.GetInstance().SerializeObject(rolesOfWinShopData));
        }
Example #8
0
 void writeDataToJson()
 {
     Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "FloydDis.json", JsonManager.GetInstance().SerializeObject(dis));
 }
Example #9
0
        void writeDataToJson()
        {
            JObject          writeJson = new JObject();
            int              index     = 0;
            List <SceneData> datas     = new List <SceneData>();

            foreach (SceneData data in dataMapping.Values)
            {
                datas.Add(data);
            }
//			datas.Sort((a, b) => a.Id.CompareTo(b.Id));
            foreach (SceneData data in datas)
            {
                data.FloydIndex = index;
                if (index == 0)
                {
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                index++;
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "Scenes.json", JsonManager.GetInstance().SerializeObject(writeJson));
            TextAsset                disAsset               = Resources.Load <TextAsset>("Data/Json/FloydDis");
            List <List <float> >     dis                    = null;
            Dictionary <int, string> cityIndexToIdMapping   = new Dictionary <int, string>();         //城镇在临接矩阵中的索引与id的关联表
            Dictionary <int, string> cityIndexToNameMapping = new Dictionary <int, string>();         //城镇在临接矩阵中的索引与城镇名的关联表

            //如果临接矩阵没有创建则创建
            if (disAsset == null)
            {
                dis = new List <List <float> >();
                for (int i = 0; i < datas.Count; i++)
                {
                    dis.Add(new List <float>());
                    for (int j = 0; j < datas.Count; j++)
                    {
                        dis[i].Add(1000);
                    }
                }
                Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "FloydDis.json", JsonManager.GetInstance().SerializeObject(dis));
            }
            else
            {
                dis = JsonManager.GetInstance().DeserializeObject <List <List <float> > >(disAsset.text);
                if (dis.Count < datas.Count)
                {
                    //新增列
                    for (int i = 0; i < dis.Count; i++)
                    {
                        for (int j = dis.Count; j < datas.Count; j++)
                        {
                            dis[i].Add(1000);
                        }
                    }
                    //新增行
                    for (int i = dis.Count; i < datas.Count; i++)
                    {
                        dis.Add(new List <float>());
                        for (int j = 0; j < datas.Count; j++)
                        {
                            dis[i].Add(1000);
                        }
                    }
                    Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "FloydDis.json", JsonManager.GetInstance().SerializeObject(dis));
                }
            }
            for (int i = 0; i < datas.Count; i++)
            {
                if (!cityIndexToIdMapping.ContainsKey(datas[i].FloydIndex))
                {
                    cityIndexToIdMapping.Add(datas[i].FloydIndex, datas[i].Id);
                    cityIndexToNameMapping.Add(datas[i].FloydIndex, datas[i].Name);
                }
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "SceneIndexToIds.json", JsonManager.GetInstance().SerializeObject(cityIndexToIdMapping));
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "SceneIndexToNames.json", JsonManager.GetInstance().SerializeObject(cityIndexToNameMapping));
        }
Example #10
0
        //绘制窗口时调用
        void OnGUI()
        {
            if (Prefab == null)
            {
                return;
            }
            else
            {
                Selection.activeGameObject = Prefab;
            }
            data = null;

            GUILayout.BeginArea(new Rect(5, 5, 800, 20));
            GUI.Label(new Rect(0, 0, 50, 18), "搜索名称:");
            searchKeyword = GUI.TextField(new Rect(55, 0, 100, 18), searchKeyword);
            if (GUI.Button(new Rect(160, 0, 30, 18), "搜索"))
            {
                selGridInt = 0;
                fetchData(searchKeyword);
            }
            GUI.Label(new Rect(195, 0, 60, 18), "区域名:");
            areaName = GUI.TextField(new Rect(260, 0, 100, 18), areaName);
            if (GUI.Button(new Rect(365, 0, 40, 18), "改名"))
            {
                if (areaData[sceneName] != null)
                {
                    areaData[sceneName]["Name"] = areaName;
                    writeAreaDataToJson();
                    this.ShowNotification(new GUIContent("改名成功"));
                }
                else
                {
                    this.ShowNotification(new GUIContent("区域名称数据不存在!"));
                }
            }
            GUILayout.EndArea();

            float listStartX   = 5;
            float listStartY   = 25;
            float scrollHeight = Screen.currentResolution.height - 110;

            if (listNames != null && listNames.Count > 0)
            {
                float contextHeight = listNames.Count * 21;
                //开始滚动视图
                scrollPosition = GUI.BeginScrollView(new Rect(listStartX, listStartY, 200, scrollHeight), scrollPosition, new Rect(5, 5, 190, contextHeight), false, scrollHeight < contextHeight);

                selGridInt = GUILayout.SelectionGrid(selGridInt, listNames.ToArray(), 1, GUILayout.Width(190));
                selGridInt = selGridInt >= listNames.Count ? listNames.Count - 1 : selGridInt;
                data       = showListData[selGridInt];
                if (selGridInt != oldSelGridInt)
                {
                    oldSelGridInt   = selGridInt;
                    showId          = data.Id;
                    eventName       = data.Name;
                    sceneEventIndex = sceneEventIndexMapping[data.Type];
                    eventId         = data.EventId;
                    string[] fen = showId.Split(new char[] { '_' });
                    Prefab.transform.position           = map.GetTilePosition(int.Parse(fen[1]), int.Parse(fen[2]));
                    SceneView.lastActiveSceneView.pivot = Prefab.transform.position;
                    switch (data.Type)
                    {
                    case SceneEventType.EnterArea:
                        birthPointEventIdIndex = allBirthPointIdIndexs.ContainsKey(data.EventId) ? allBirthPointIdIndexs[data.EventId] : 0;
                        break;

                    case SceneEventType.EnterCity:
                        citySceneIdIndex = allCitySceneIdIndexs.ContainsKey(data.EventId) ? allCitySceneIdIndexs[data.EventId] : 0;
                        break;

                    case SceneEventType.Battle:
                        fightEventIdIndex = allFightIdIndexs.ContainsKey(data.EventId) ? allFightIdIndexs[data.EventId] : 0;
                        break;

                    default:
                        break;
                    }
                    eventOpenTypeIndex = sceneEventOpenIndexMapping.ContainsKey(data.OpenType) ? sceneEventOpenIndexMapping[data.OpenType] : 0;
                    switch (sceneEventOpenTypeEnums[eventOpenTypeIndex])
                    {
                    case SceneEventOpenType.FightWined:
                        if (allFightNames.Count <= openKeyIndex)
                        {
                            openKeyIndex = 0;
                        }
                        openKeyIndex = allFightIdIndexs.ContainsKey(data.OpenKey) ? allFightIdIndexs[data.OpenKey] : 0;
                        break;

                    case SceneEventOpenType.NeedItem:
                        if (Base.ItemDataNames.Count <= openKeyIndex)
                        {
                            openKeyIndex = 0;
                        }
                        openKeyIndex = Base.ItemDataIdIndexs.ContainsKey(data.OpenKey) ? Base.ItemDataIdIndexs[data.OpenKey] : 0;
                        break;

                    case SceneEventOpenType.NeedTasks:
                        stringValue = !string.IsNullOrEmpty(data.StringValue) ? data.StringValue : "";
                        break;

                    default:
                        openKey = "";
                        break;
                    }
                    eventNotice = data.Notice;
                    intValue    = data.IntValue;
                    if (meetEnemyRatesMapping.ContainsKey(sceneName))
                    {
                        currentMeetEnemyRates = meetEnemyRatesMapping[sceneName];
                    }
                    else
                    {
                        currentMeetEnemyRates = new List <RateData>();
                        meetEnemyRatesMapping.Add(sceneName, currentMeetEnemyRates);
                    }
                    for (int i = 0; i < currentMeetEnemyRates.Count; i++)
                    {
                        currentMeetEnemyRates[i].IdIndex = allFightIdIndexs.ContainsKey(currentMeetEnemyRates[i].Id) ? allFightIdIndexs[currentMeetEnemyRates[i].Id] : 0;
                    }
                }
                //结束滚动视图
                GUI.EndScrollView();

                if (data != null)
                {
                    GUILayout.BeginArea(new Rect(listStartX + 205, listStartY, 800, 300));
                    GUI.Label(new Rect(0, 0, 60, 18), "Id:");
                    EditorGUI.TextField(new Rect(65, 0, 150, 18), showId);
                    GUI.Label(new Rect(220, 0, 50, 18), "开启条件:");
                    eventOpenTypeIndex = EditorGUI.Popup(new Rect(275, 0, 80, 18), eventOpenTypeIndex, sceneEventOpenStrs.ToArray());
                    switch (sceneEventOpenTypeEnums[eventOpenTypeIndex])
                    {
                    case SceneEventOpenType.FightWined:
                        if (allFightNames.Count <= openKeyIndex)
                        {
                            openKeyIndex = 0;
                        }
                        openKeyIndex = EditorGUI.Popup(new Rect(360, 0, 150, 18), openKeyIndex, allFightNames.ToArray());
                        openKey      = allFights[openKeyIndex].Id;
                        eventNotice  = EditorGUI.TextArea(new Rect(515, 0, 100, 36), eventNotice);
                        break;

                    case SceneEventOpenType.NeedItem:
                        if (Base.ItemDataNames.Count <= openKeyIndex)
                        {
                            openKeyIndex = 0;
                        }
                        openKeyIndex = EditorGUI.Popup(new Rect(360, 0, 150, 18), openKeyIndex, Base.ItemDataNames.ToArray());
                        openKey      = Base.ItemDatas[openKeyIndex].Id;
                        eventNotice  = EditorGUI.TextArea(new Rect(515, 0, 100, 36), eventNotice);
                        break;

                    case SceneEventOpenType.NeedTasks:
                        stringValue = EditorGUI.TextField(new Rect(360, 0, 150, 18), stringValue);
                        eventNotice = EditorGUI.TextArea(new Rect(515, 0, 100, 36), eventNotice);
                        break;

                    default:
                        openKey = "";
                        break;
                    }
                    GUI.Label(new Rect(0, 20, 60, 18), "事件名称:");
                    eventName = EditorGUI.TextField(new Rect(65, 20, 150, 18), eventName);
                    GUI.Label(new Rect(0, 40, 60, 18), "事件类型:");
                    sceneEventIndex = EditorGUI.Popup(new Rect(65, 40, 150, 18), sceneEventIndex, sceneEventStrs.ToArray());

                    switch (sceneEventTypeEnums[sceneEventIndex])
                    {
                    case SceneEventType.EnterArea:
                        birthPointEventIdIndex = EditorGUI.Popup(new Rect(220, 40, 150, 18), birthPointEventIdIndex, allBirthPointNames.ToArray());
                        eventId = allBirthPointEvents[birthPointEventIdIndex].Id;
                        break;

                    case SceneEventType.EnterCity:
                        citySceneIdIndex = EditorGUI.Popup(new Rect(220, 40, 150, 18), citySceneIdIndex, allCitySceneNames.ToArray());
                        eventId          = allCityScenes[citySceneIdIndex].Id;
                        break;

                    case SceneEventType.Battle:
                        fightEventIdIndex = EditorGUI.Popup(new Rect(220, 40, 150, 18), fightEventIdIndex, allFightNames.ToArray());
                        eventId           = allFights[fightEventIdIndex].Id;
                        break;

                    case SceneEventType.EatFood:
                        GUI.Label(new Rect(220, 40, 65, 18), "开启干粮数:");
                        intValue = (int)EditorGUI.Slider(new Rect(285, 40, 180, 18), (float)intValue, 1, 99);
                        break;

                    default:
                        break;
                    }

                    GUI.Label(new Rect(0, 60, 100, 18), "事件Id:");
                    eventId = EditorGUI.TextField(new Rect(65, 60, 150, 18), eventId);

                    if (GUI.Button(new Rect(0, 80, 80, 18), "修改事件"))
                    {
                        if (eventName == "")
                        {
                            this.ShowNotification(new GUIContent("事件名不能为空!"));
                            return;
                        }
                        if (eventId == "")
                        {
                            this.ShowNotification(new GUIContent("事件Id不能为空!"));
                            return;
                        }
                        data.Name        = eventName;
                        data.Type        = sceneEventTypeEnums[sceneEventIndex];
                        data.EventId     = eventId;
                        data.OpenType    = sceneEventOpenTypeEnums[eventOpenTypeIndex];
                        data.OpenKey     = openKey;
                        data.Notice      = eventNotice;
                        data.IntValue    = intValue;
                        data.StringValue = stringValue;
                        writeDataToJson();
                        oldSelGridInt = -1;
                        getData();
                        fetchData(searchKeyword);
                        this.ShowNotification(new GUIContent("修改成功"));
                    }
                    string[] fen = showId.Split(new char[] { '_' });
                    if (fen.Length >= 3)
                    {
                        int i = int.Parse(fen[1]);
                        int j = int.Parse(fen[2]);
                        if (map.GetTileInfoForTileId(map.GetTile(i, j, 1)) == null)
                        {
                            if (GUI.Button(new Rect(85, 80, 300, 18), "该事件已从场景中被删除,点击清除此残余数据"))
                            {
                                if (!dataMapping.ContainsKey(data.Id))
                                {
                                    this.ShowNotification(new GUIContent("要删除的数据不存在!"));
                                    return;
                                }
                                dataMapping.Remove(data.Id);
                                writeDataToJson();
                                oldSelGridInt = -1;
                                getData();
                                fetchData(searchKeyword);
                                this.ShowNotification(new GUIContent("删除残余事件成功"));
                            }
                        }
                    }
                    GUILayout.EndArea();

                    GUILayout.BeginArea(new Rect(listStartX + 205, listStartY + 305, 800, 500));
                    GUI.Label(new Rect(0, 0, 60, 18), "随机遇敌:");
                    RateData rateData;
                    for (int i = 0; i < currentMeetEnemyRates.Count; i++)
                    {
                        if (currentMeetEnemyRates.Count <= i)
                        {
                            continue;
                        }
                        rateData = currentMeetEnemyRates[i];
                        GUI.Label(new Rect(0, 20 + i * 20, 60, 18), "遇敌战斗:");
                        rateData.IdIndex = EditorGUI.Popup(new Rect(65, 20 + i * 20, 150, 18), rateData.IdIndex, allFightNames.ToArray());
                        rateData.Id      = allFights[rateData.IdIndex].Id;
                        GUI.Label(new Rect(220, 20 + i * 20, 60, 18), "遇敌概率:");
                        rateData.Rate = EditorGUI.Slider(new Rect(285, 20 + i * 20, 180, 18), rateData.Rate, 0, 100);
                        if (GUI.Button(new Rect(470, 20 + i * 20, 40, 18), "删除"))
                        {
                            currentMeetEnemyRates.RemoveAt(i);
                        }
                    }
                    if (GUI.Button(new Rect(0, 180, 60, 18), "修改战斗"))
                    {
//						if (currentMeetEnemyRates.Count == 0) {
//							this.ShowNotification(new GUIContent("还没有添加任何随机战斗!"));
//							return;
//						}
                        Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "AreaMeetEnemys.json", JsonManager.GetInstance().SerializeObject(meetEnemyRatesMapping));
                        this.ShowNotification(new GUIContent("修改随机遇敌数据成功"));
                    }
                    if (GUI.Button(new Rect(65, 180, 60, 18), "添加战斗"))
                    {
                        if (currentMeetEnemyRates.Count >= 8)
                        {
                            this.ShowNotification(new GUIContent("每个区域最多出现8种战斗!"));
                            return;
                        }
                        currentMeetEnemyRates.Add(new RateData(100, "0", 0));
                    }

                    GUILayout.EndArea();
                }
            }
        }
Example #11
0
 static void writeAreaDataToJson()
 {
     Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "AreaNames.json", JsonManager.GetInstance().SerializeObject(areaData));
 }