Example #1
0
        public Person AddPersonFromData(int personid)
        {
            if (!DataMgr.Instacne.dic_Person.ContainsKey(personid))
            {
                LogTool.LogError("DataMgr not have id " + personid);
                return(null);
            }
            DPerson    dfaction = DataMgr.Instacne.dic_Person[personid];
            GameObject go       = new GameObject("person_" + personid);

            go.transform.SetParent(personEntityParent);
            Person person = go.AddComponent <Person>();

            person.Data = dfaction;
            dic_Person.Add(person.ID, person);
            return(person);
        }
Example #2
0
        private void LoadPerson(string fold)
        {
            string filePath = fold + "/person.csv";

            personFile = new CSVFile();
            personFile.ReadCsv(filePath);
            dic_Person.Clear();
            foreach (string[] arr in cityFile.valueLines)
            {
                if (arr.Length != 16)
                {
                    LogTool.LogError("city arr.length" + arr.Length);
                    continue;
                }
                DPerson person = new DPerson();
                person.id           = int.Parse(arr[0]);
                person.alias        = arr[1];
                person.shortdesc    = arr[2];
                person.fulldesc     = arr[3];
                person.firstname    = arr[4];
                person.secondname   = arr[5];
                person.thirdname    = arr[6];
                person.bornyear     = int.Parse(arr[7]);
                person.bornmonth    = int.Parse(arr[8]);
                person.bornday      = int.Parse(arr[9]);
                person.isfreeperson = bool.Parse(arr[10]);
                person.isprison     = bool.Parse(arr[11]);
                person.canhire      = bool.Parse(arr[12]);
                person.curleftexp   = int.Parse(arr[13]);

                person.tong = int.Parse(arr[14]);
                person.wu   = int.Parse(arr[15]);
                person.zhi  = int.Parse(arr[16]);
                person.zhen = int.Parse(arr[17]);
                person.mei  = int.Parse(arr[18]);

                person.level_bubing    = int.Parse(arr[19]);
                person.level_qibing    = int.Parse(arr[20]);
                person.level_gongbing  = int.Parse(arr[21]);
                person.level_shuibing  = int.Parse(arr[22]);
                person.level_gongcheng = int.Parse(arr[23]);
                dic_Person.Add(person.id, person);
                EntityMgr.Instacne.AddPersonFromData(person.id);
            }
        }