Beispiel #1
0
        public bool Reset()
        {
            Debug.Log("Property Reset - " + tableId);
            var tb = R.GetPropertyInfo(tableId);

            Debug.Assert(null != tb, "Not exist table id : " + tableId);
            this.tb = tb;

            vEyeLevel = new Vector3(0, tb.eyeLevel, 0);
            // variable reset
            health  = tb.max_health;
            isAlive = true;

            return(true);
        }
        private bool LoadFromCSV(string path)
        {
            if (path.Length > 0 && !(path[path.Length - 1] == '\\' || path[path.Length - 1] != '/'))
            {
                path += '\\';
            }
            CSV.csvTable table;
            Dictionary <string, CSV.csvTable> mapCSVTable;

            try {
                mapCSVTable = ReadCSV_FromAsset(path + "csv_Data/PropertyTable");
                Assert(null != mapCSVTable);
                if (null != mapCSVTable)
                {
                    if (mapCSVTable.TryGetValue("PropertyInfo", out table))
                    {
                        var dic = this._data_PropertyInfo = new Dictionary <PropertyInfo.eID, R.PropertyInfo>();
                        foreach (var rec in table.tRecords)
                        {
                            R.PropertyInfo newOne = new R.PropertyInfo(rec.tContents);
                            dic.Add(newOne.id, newOne);
                        }
                    }
                    if (mapCSVTable.TryGetValue("Speeches", out table))
                    {
                        var dic = this._data_Speeches = new Dictionary <Speeches.eKey, R.Speeches>();
                        foreach (var rec in table.tRecords)
                        {
                            R.Speeches newOne = new R.Speeches(rec.tContents);
                            dic.Add(newOne.id, newOne);
                        }
                    }
                    if (mapCSVTable.TryGetValue("Seq", out table))
                    {
                        var dic = this._data_Seq = new Dictionary <Seq.eState, R.Seq>();
                        foreach (var rec in table.tRecords)
                        {
                            R.Seq newOne = new R.Seq(rec.tContents);
                            dic.Add(newOne.state, newOne);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                throw e;
            }
            try {
                mapCSVTable = ReadCSV_FromAsset(path + "csv_Data/SecureInfo");
                Assert(null != mapCSVTable);
                if (null != mapCSVTable)
                {
                    if (mapCSVTable.TryGetValue("Secure", out table))
                    {
                        var dic = this._data_Secure = new Dictionary <Secure.eKey, R.Secure>();
                        foreach (var rec in table.tRecords)
                        {
                            R.Secure newOne = new R.Secure(rec.tContents);
                            dic.Add(newOne.id, newOne);
                        }
                    }
                    if (mapCSVTable.TryGetValue("illegalApp", out table))
                    {
                        var dic = this._data_illegalApp = new Dictionary <string, R.illegalApp>();
                        foreach (var rec in table.tRecords)
                        {
                            R.illegalApp newOne = new R.illegalApp(rec.tContents);
                            dic.Add(newOne.Text, newOne);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                throw e;
            }
            try {
                mapCSVTable = ReadCSV_FromAsset(path + "csv_Data/ConstantTable");
                Assert(null != mapCSVTable);
                if (null != mapCSVTable)
                {
                    if (mapCSVTable.TryGetValue("DefaultValue", out table))
                    {
                        var dic = this._data_DefaultValue = new Dictionary <int, R.DefaultValue>();
                        foreach (var rec in table.tRecords)
                        {
                            R.DefaultValue newOne = new R.DefaultValue(rec.tContents);
                            dic.Add(newOne.IDX, newOne);
                        }
                    }
                    if (mapCSVTable.TryGetValue("TestEnumTable", out table))
                    {
                        var dic = this._data_TestEnumTable = new Dictionary <TestEnumTable.eID, R.TestEnumTable>();
                        foreach (var rec in table.tRecords)
                        {
                            R.TestEnumTable newOne = new R.TestEnumTable(rec.tContents);
                            dic.Add(newOne.id, newOne);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                throw e;
            }
            return(true);
        }