private List <string[]> TransferGoodsIdsToString(MyNpc trader)
        {
            List <string[]> goodsListTotal = new List <string[]> ();

            for (int i = 0; i < trader.goodsGroupList.Count; i++)
            {
                GoodsGroup gg = trader.goodsGroupList [i];

                string[] idsInString = new string[5];

                for (int j = 0; j < 5; j++)
                {
                    Goods g = gg.goodsList [j];

                    StringBuilder sb = new StringBuilder();

                    for (int k = 0; k < g.possibleItemIdsAsGoods.Length; k++)
                    {
                        sb.AppendFormat("{0}_", g.possibleItemIdsAsGoods [k].ToString());
                    }

                    sb.Remove(sb.Length - 1, 1);

                    idsInString [j] = sb.ToString();
                }

                goodsListTotal.Add(idsInString);
            }

            return(goodsListTotal);
        }
Example #2
0
        public MyGameLevelData(string dataString, int currenLevel, List <GoodsGroup> allGoodsGroup)
        {
            dataString = dataString.Replace("\r", "");

            string[] dataStrings = dataString.Split(new char[] { ',' }, System.StringSplitOptions.None);

            gameLevelIndex = Convert.ToInt16(dataStrings [0]);
            chapterName    = dataStrings [1];

            monsterInfos = InitMonsterInfoWith(dataStrings [2], dataStrings [3]);

            mustAppearItemIdsInUnlockedBox = InitIntArrayWithString(dataStrings [4]);

            possiblyAppearItemIdsInUnlockedBox = InitIntArrayWithString(dataStrings [5]);

            possiblyAppearItemIdsInLockedBox = InitIntArrayWithString(dataStrings [6]);

            GoodsGroup goodsGroups = InitGoodsGroupArrayWith(currenLevel, dataStrings [7], dataStrings [8], dataStrings [9], dataStrings [10], dataStrings [11]);

            allGoodsGroup.Add(goodsGroups);

            monsterScaler = Convert.ToSingle(dataStrings [12]);

            bossId = FromStringToInt(dataStrings [13]);
        }
Example #3
0
        private GoodsGroup InitGoodsGroupArrayWith(int currentLevel, params string[] goodsStrings)
        {
            List <Goods> goodsList = new List <Goods> ();

            for (int i = 0; i < goodsStrings.Length; i++)
            {
                string goodsString = goodsStrings [i];

                Goods goods = new Goods(InitIntArrayWithString(goodsString));

                goodsList.Add(goods);
            }

            GoodsGroup gg = new GoodsGroup(goodsList, currentLevel);

            return(gg);
        }
Example #4
0
        public void InitGoodsGroupOfLevel(int level)
        {
            itemsAsGoodsOfCurrentLevel.Clear();

            GoodsGroup gg = goodsGroupList.Find(delegate(GoodsGroup obj) {
                return(obj.accordLevel == level);
            });

            for (int i = 0; i < gg.goodsList.Count; i++)
            {
                Goods goods = gg.goodsList [i];

                Item itemAsGoods = goods.GetRandomPossibleGoods();

                itemsAsGoodsOfCurrentLevel.Add(itemAsGoods);
            }
        }
        private void CreateNPCBaseInformationGUI()
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("npc的id:", labelLayouts);

            npc.npcId = EditorGUILayout.IntField(npc.npcId, normalInputLayouts);

            GUILayout.EndHorizontal();

            // name 编辑行
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("npc名称:", labelLayouts);

            npc.npcName = EditorGUILayout.TextField(npc.npcName, normalInputLayouts);

            EditorGUILayout.EndHorizontal();

            // npc图片名称编辑行
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("npc图片名称:", labelLayouts);

            npc.spriteName = EditorGUILayout.TextField(npc.spriteName, normalInputLayouts);

            EditorGUILayout.EndHorizontal();

            // npc类型编辑行
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("npc的类型:", labelLayouts);

            npcType = (NPCType)EditorGUILayout.EnumPopup(npcType, toggleLayouts);



            EditorGUILayout.EndHorizontal();

            switch (npcType)
            {
            case NPCType.Normal:
                break;

            case NPCType.Trader:

                EditorGUILayout.BeginHorizontal();

                bool addNewGoodsGroup = GUILayout.Button("新增商品组:", new GUILayoutOption[] {
                    GUILayout.Height(20),
                    GUILayout.Width(100)
                });

                bool removeLastGoodsGroup = GUILayout.Button("删除尾部商品组", new GUILayoutOption[] {
                    GUILayout.Height(20),
                    GUILayout.Width(100)
                });

                EditorGUILayout.EndHorizontal();

                if (addNewGoodsGroup)
                {
                    GoodsGroup goodsGroup = new GoodsGroup();

                    npc.goodsGroupList.Add(goodsGroup);

                    bool goodsGroupFoldout = false;

                    goodsGroupFoldoutList.Add(goodsGroupFoldout);
                }

                if (removeLastGoodsGroup && npc.goodsGroupList.Count > 0)
                {
                    npc.goodsGroupList.RemoveAt(npc.goodsGroupList.Count - 1);
                    goodsGroupFoldoutList.RemoveAt(goodsGroupFoldoutList.Count - 1);
                }

                for (int i = 0; i < npc.goodsGroupList.Count; i++)
                {
                    GoodsGroup goodsGroup = npc.goodsGroupList [i];


                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField(string.Format("商品组{0}对应的关卡", i), labelLayouts);

                    goodsGroup.accordLevel = EditorGUILayout.IntField(goodsGroup.accordLevel, normalInputLayouts);

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();

                    bool addNewGoods = GUILayout.Button("新增商品组", new GUILayoutOption[] {
                        GUILayout.Height(20),
                        GUILayout.Width(100)
                    });

                    bool removeLastGoods = GUILayout.Button("删除尾部商品组", new GUILayoutOption[] {
                        GUILayout.Height(20),
                        GUILayout.Width(100)
                    });



                    if (addNewGoods)
                    {
                        Goods goods = new Goods();
                        goodsGroup.goodsList.Add(goods);
                    }

                    if (removeLastGoods && goodsGroup.goodsList.Count > 0)
                    {
                        goodsGroup.goodsList.RemoveAt(goodsGroup.goodsList.Count - 1);
                    }

                    for (int j = 0; j < goodsGroup.goodsList.Count; j++)
                    {
                        Goods goods = goodsGroup.goodsList [j];

                        EditorGUILayout.BeginHorizontal();

                        EditorGUILayout.LabelField("物品id组:", new GUILayoutOption[] {
                            GUILayout.Height(20),
                            GUILayout.Width(50)
                        });

                        string possibleGoodsIdsInString = goodsIdsInString[i][j];
                        possibleGoodsIdsInString = EditorGUILayout.TextField(possibleGoodsIdsInString, normalInputLayouts);

                        goods.possibleItemIdsAsGoods = IdsStringToIntArray(possibleGoodsIdsInString);

                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.EndHorizontal();
                }

                break;
            }

            // npc打招呼文字编辑行
            EditorGUILayout.LabelField("npc打招呼文字:", labelLayouts);

            npc.greetingDialog = EditorGUILayout.TextArea(npc.greetingDialog, textInputLayouts);

            // npc附加功能编辑组

            EditorGUILayout.LabelField("npc附加功能编辑区:", labelLayouts);


            skillPromotionFunction = EditorGUILayout.Toggle("技能提升", skillPromotionFunction, toggleLayouts);

            propertyPromotionFunction = EditorGUILayout.Toggle("属性提升", propertyPromotionFunction, toggleLayouts);

            taskFunction = EditorGUILayout.Toggle("任务", taskFunction, toggleLayouts);

            characterTradeFunction = EditorGUILayout.Toggle("交易", characterTradeFunction, toggleLayouts);
        }