private bool LoadListInfo(Dictionary <int, ListInfoBase> dictData, TextAsset ta)
        {
            if (Object.op_Equality((Object)null, (Object)ta))
            {
                return(false);
            }
            ChaListData chaListData = (ChaListData)MessagePackSerializer.Deserialize <ChaListData>(ta.get_bytes());

            if (chaListData == null)
            {
                return(false);
            }
            foreach (KeyValuePair <int, List <string> > dict in chaListData.dictList)
            {
                int          count        = dictData.Count;
                ListInfoBase listInfoBase = new ListInfoBase();
                if (listInfoBase.Set(count, chaListData.categoryNo, chaListData.distributionNo, chaListData.lstKey, dict.Value))
                {
                    if (dictData.ContainsKey(listInfoBase.Id))
                    {
                        Debug.LogWarningFormat("[{0}] カスタムリストのIDが重複しています。", new object[1]
                        {
                            (object)(listInfoBase.Category * 1000 + listInfoBase.Id)
                        });
                    }
                    else
                    {
                        dictData[listInfoBase.Id] = listInfoBase;
                        int infoInt = listInfoBase.GetInfoInt(ChaListDefine.KeyType.Possess);
                        int num     = listInfoBase.Category * 1000 + listInfoBase.Id;
                        switch (infoInt)
                        {
                        case 1:
                            this.lstItemIsInit.Add(num);
                            continue;

                        case 2:
                            this.lstItemIsNew.Add(num);
                            continue;

                        default:
                            continue;
                        }
                    }
                }
            }
            return(true);
        }
Beispiel #2
0
        public bool InitGameInfoParam()
        {
            ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
            ListInfoBase   listInfo    = chaListCtrl.GetListInfo(ChaListDefine.CategoryNo.init_type_param, this.parameter.personality);

            this.gameinfo.moodBound.lower = (float)listInfo.GetInfoInt(ChaListDefine.KeyType.MoodLow);
            this.gameinfo.moodBound.upper = (float)listInfo.GetInfoInt(ChaListDefine.KeyType.MoodUp);
            this.gameinfo.flavorState     = new Dictionary <int, int>();
            for (int index = 0; index < 8; ++index)
            {
                this.gameinfo.flavorState[index] = 0;
            }
            this.gameinfo.desireDefVal  = new Dictionary <int, float>();
            this.gameinfo.desireBuffVal = new Dictionary <int, float>();
            for (int index = 0; index < 16; ++index)
            {
                this.gameinfo.desireDefVal[index]  = 0.0f;
                this.gameinfo.desireBuffVal[index] = 0.0f;
            }
            this.gameinfo.motivation = 0;
            this.gameinfo.immoral    = 0;
            this.gameinfo.morality   = 50;
            for (int index1 = 0; index1 < 8; ++index1)
            {
                Dictionary <int, int> flavorState;
                int index2;
                (flavorState = this.gameinfo.flavorState)[index2 = index1] = flavorState[index2] + listInfo.GetInfoInt((ChaListDefine.KeyType)(96 + index1));
            }
            for (int index1 = 0; index1 < 16; ++index1)
            {
                Dictionary <int, float> desireDefVal;
                int index2;
                (desireDefVal = this.gameinfo.desireDefVal)[index2 = index1] = desireDefVal[index2] + (float)listInfo.GetInfoInt((ChaListDefine.KeyType)(104 + index1));
                Dictionary <int, float> desireBuffVal;
                int index3;
                (desireBuffVal = this.gameinfo.desireBuffVal)[index3 = index1] = desireBuffVal[index3] + (float)listInfo.GetInfoInt((ChaListDefine.KeyType)(120 + index1));
            }
            this.gameinfo.motivation += listInfo.GetInfoInt(ChaListDefine.KeyType.Motivation);
            this.gameinfo.immoral    += listInfo.GetInfoInt(ChaListDefine.KeyType.Immoral);
            Dictionary <int, ListInfoBase> categoryInfo = chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.init_wish_param);

            if (this.parameter.hsWish != null && this.parameter.hsWish.Count != 0)
            {
                foreach (int key in this.parameter.hsWish)
                {
                    ListInfoBase listInfoBase;
                    if (categoryInfo.TryGetValue(key, out listInfoBase))
                    {
                        this.gameinfo.moodBound.lower += (float)listInfoBase.GetInfoInt(ChaListDefine.KeyType.MoodLow);
                        this.gameinfo.moodBound.upper += (float)listInfoBase.GetInfoInt(ChaListDefine.KeyType.MoodUp);
                        for (int index1 = 0; index1 < 8; ++index1)
                        {
                            Dictionary <int, int> flavorState;
                            int index2;
                            (flavorState = this.gameinfo.flavorState)[index2 = index1] = flavorState[index2] + listInfoBase.GetInfoInt((ChaListDefine.KeyType)(96 + index1));
                        }
                        for (int index1 = 0; index1 < 16; ++index1)
                        {
                            Dictionary <int, float> desireDefVal;
                            int index2;
                            (desireDefVal = this.gameinfo.desireDefVal)[index2 = index1] = desireDefVal[index2] + (float)listInfoBase.GetInfoInt((ChaListDefine.KeyType)(104 + index1));
                            Dictionary <int, float> desireBuffVal;
                            int index3;
                            (desireBuffVal = this.gameinfo.desireBuffVal)[index3 = index1] = desireBuffVal[index3] + (float)listInfoBase.GetInfoInt((ChaListDefine.KeyType)(120 + index1));
                        }
                        this.gameinfo.motivation += listInfoBase.GetInfoInt(ChaListDefine.KeyType.Motivation);
                        this.gameinfo.immoral    += listInfoBase.GetInfoInt(ChaListDefine.KeyType.Immoral);
                    }
                }
            }
            for (int index = 0; index < 8; ++index)
            {
                this.gameinfo.flavorState[index] = Mathf.Max(this.gameinfo.flavorState[index], 0);
            }
            return(true);
        }