Ejemplo n.º 1
0
        /// <summary>
        /// StringGridのデータ解析
        /// </summary>
        /// <param name="grid">解析するデータ</param>
        protected override void ParseFromStringGrid(StringGrid grid)
        {
            string name = "";

            foreach (StringGridRow row in grid.Rows)
            {
                if (row.RowIndex < grid.DataTopRow)
                {
                    continue;                                                                   //データの行じゃない
                }
                if (row.IsEmpty)
                {
                    continue;                                                                                           //データがない
                }
                //名前は空白なら、直前のものと同じ
                name = AdvParser.ParseCellOptional <string>(row, AdvColumnName.CharacterName, name);
                string key = ToFileKey(name, AdvParser.ParseCellOptional <string>(row, AdvColumnName.Pattern, ""));

                Vector2 pivot = Vector2.one * 0.5f;
                try
                {
                    pivot = PivotUtil.ParsePivotOptional(AdvParser.ParseCellOptional <string>(row, AdvColumnName.Pivot, ""), pivot);
                }
                catch (System.Exception e)
                {
                    Debug.LogError(row.ToErrorString(e.Message));
                }
                //データ追加
                AdvCharacterSettingData data = new AdvCharacterSettingData();
                data.Init(key, pivot,
                          AdvParser.ParseCellOptional <float>(row, AdvColumnName.Scale, 1.0f),
                          AdvParser.ParseCell <string>(row, AdvColumnName.FileName),
                          AdvParser.ParseCellOptional <int>(row, AdvColumnName.Version, 0));
                Add(data);
                if (!defaultKey.ContainsKey(name))
                {
                    defaultKey.Add(name, key);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// StringGridの一行からデータ初期化
        /// </summary>
        /// <param name="row">初期化するためのデータ</param>
        /// <returns>成否</returns>
        public override bool InitFromStringGridRow(StringGridRow row)
        {
            string key = AdvParser.ParseCell <string>(row, AdvColumnName.Label);

            InitKey(key);
            this.type = AdvParser.ParseCell <Type>(row, AdvColumnName.Type);

            this.pivot = Vector2.one * 0.5f;
            try
            {
                this.pivot = PivotUtil.ParsePivotOptional(AdvParser.ParseCellOptional <string>(row, AdvColumnName.Pivot, ""), pivot);
            }
            catch (System.Exception e)
            {
                Debug.LogError(row.ToErrorString(e.Message));
            }
            this.scale = AdvParser.ParseCellOptional <float>(row, AdvColumnName.Scale, 1.0f);

            this.fileName         = AdvParser.ParseCell <string>(row, AdvColumnName.FileName);
            this.version          = AdvParser.ParseCellOptional <int>(row, AdvColumnName.Version, 0);
            this.thumbnailName    = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Thumbnail, "");
            this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0);
            return(true);
        }