Пример #1
0
        /// <summary>
        /// ヘッダーの解析
        /// </summary>
        /// <param name="headerRow">ヘッダー情報のある行番号</param>
        public void ParseHeader(int headerRow)
        {
            this.headerRow = headerRow;
            ColumnIndexTbl = new Dictionary <string, int>();
            if (headerRow < Rows.Count)
            {
                StringGridRow row = Rows[headerRow];
                for (int i = 0; i < row.Strings.Length; ++i)
                {
                    string key = row.Strings[i];
                    if (ColumnIndexTbl.ContainsKey(key))
                    {
                        string errorMsg = "";
//						if( string.IsNullOrWhiteSpace(key) )
//						{
//							errorMsg += row.ToErrorString( "empty header in row:" + UtageToolKit.AddColorTag(""+i,"red") );
//						}
//						else
                        {
                            errorMsg += row.ToErrorString(ColorUtil.AddColorTag(key, Color.red) + "  is already contains");
                        }
                        Debug.LogError(errorMsg);
                    }
                    else
                    {
                        ColumnIndexTbl.Add(key, i);
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.StringGridParseHaeder, headerRow, this.name));
            }
        }
Пример #2
0
        void OnGUI()
        {
            GUILayout.Label("Utage version " + VersionUtil.Version);

            GUILayout.Space(10);
            GUIStyle style = GUI.skin.label;

            style.richText = true;
            if (GUILayout.Button(ColorUtil.AddColorTag("WebSite", Color.blue), style))
            {
                Application.OpenURL(url);
            }
            GUILayout.Space(8);
            if (GUILayout.Button(ColorUtil.AddColorTag("Document", Color.blue), style))
            {
                Application.OpenURL(documentUrl);
            }
            GUILayout.Space(8);
            if (GUILayout.Button(ColorUtil.AddColorTag("Sample Links", Color.blue), style))
            {
                Application.OpenURL(sampleUrl);
            }

            GUILayout.Space(8);
            if (GUILayout.Button(ColorUtil.AddColorTag("Version3 Fetures", Color.blue), style))
            {
                Application.OpenURL(version3FeturesUrl);
            }
        }
Пример #3
0
 /// <summary>
 /// ヘッダーの解析
 /// </summary>
 /// <param name="headerRow">ヘッダー情報のある行番号</param>
 public void ParseHeader(int headerRow)
 {
     UnityEngine.Profiling.Profiler.BeginSample("ParseHeader");
     this.headerRow = headerRow;
     ColumnIndexTbl = new Dictionary <string, int>();
     if (headerRow < Rows.Count)
     {
         StringGridRow row = Rows[headerRow];
         for (int i = 0; i < row.Strings.Length; ++i)
         {
             string key = row.Strings[i];
             if (ColumnIndexTbl.ContainsKey(key))
             {
                 string errorMsg = "";
                 if (!string.IsNullOrEmpty(key))
                 {
                     errorMsg += row.ToErrorString(ColorUtil.AddColorTag(key, Color.red) + "  is already contains");
                     Debug.LogError(errorMsg);
                 }
             }
             else
             {
                 ColumnIndexTbl.Add(key, i);
             }
         }
     }
     else
     {
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.StringGridParseHaeder, headerRow, this.name));
     }
     UnityEngine.Profiling.Profiler.EndSample();
 }
 /// <summary>
 /// 文字列グリッドから、データ解析
 /// </summary>
 /// <param name="grid"></param>
 protected virtual void ParseFromStringGrid(StringGrid grid)
 {
     foreach (StringGridRow row in grid.Rows)
     {
         if (row.RowIndex < grid.DataTopRow)
         {
             continue;                                                                   //データの行じゃない
         }
         if (row.IsEmpty)
         {
             continue;                                                                                           //データがない
         }
         T data = new T();
         if (data.InitFromStringGridRow(row))
         {
             if (!ContainsKey(data.Key))
             {
                 Add(data);
             }
             else
             {
                 string errorMsg = "";
                 errorMsg += row.ToErrorString(ColorUtil.AddColorTag(data.Key, Color.red) + "  is already contains");
                 Debug.LogError(errorMsg);
             }
         }
     }
 }
 public void ParseHeader(int headerRow)
 {
     this.headerRow      = headerRow;
     this.ColumnIndexTbl = new Dictionary <string, int>();
     if (headerRow < this.Rows.Count)
     {
         StringGridRow row = this.Rows[headerRow];
         for (int i = 0; i < row.Strings.Length; i++)
         {
             string key = row.Strings[i];
             if (this.ColumnIndexTbl.ContainsKey(key))
             {
                 string str2 = string.Empty;
                 if (!string.IsNullOrEmpty(key))
                 {
                     Debug.LogError(str2 + row.ToErrorString(ColorUtil.AddColorTag(key, Color.get_red()) + "  is already contains"));
                 }
             }
             else
             {
                 this.ColumnIndexTbl.Add(key, i);
             }
         }
     }
     else
     {
         object[] args = new object[] { headerRow, this.name };
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.StringGridParseHaeder, args));
     }
 }
Пример #6
0
        public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            string path = MonoScriptHelper.CurrentUtageRootDirectory + "/Sample/Resources/Sample";

            if (System.IO.Directory.Exists(path))
            {
                Debug.LogWarning(ColorUtil.AddColorTag("Sample resouces exist. Delete or move folder " + path, Color.red));
            }
        }
Пример #7
0
        //連続するデータとして追加できる場合はする。基本はしない
        protected override AdvCharacterSettingData ParseFromStringGridRow(AdvCharacterSettingData last, StringGridRow row, AdvBootSetting bootSetting)
        {
            //キャラ名
            string name = AdvParser.ParseCellOptional <string>(row, AdvColumnName.CharacterName, "");
            //表示パターン
            string pattern = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Pattern, "");
            //表示名
            string nameText = AdvParser.ParseCellOptional <string>(row, AdvColumnName.NameText, "");

            //キャラ名が空白なら、直前と同じキャラ名を使う
            if (string.IsNullOrEmpty(name))
            {
                if (last == null)
                {
                    Debug.LogError(row.ToErrorString("Not Found Chacter Name"));
                    return(null);
                }
                name = last.Name;
            }

            //表示名が空で、直前のデータとキャラ名が同じならその名前を使う
            if (string.IsNullOrEmpty(nameText))
            {
                if (last != null && (name == last.Name))
                {
                    nameText = last.NameText;
                }
                else
                {
                    nameText = name;
                }
            }

            AdvCharacterSettingData data = new AdvCharacterSettingData();

            data.Init(name, pattern, nameText, row);

            if (!Dictionary.ContainsKey(data.Key))
            {
                AddData(data);
                data.BootInit(bootSetting);
                if (!defaultKey.ContainsKey(name))
                {
                    defaultKey.Add(name, data.Key);
                }
                return(data);
            }
            else
            {
                string errorMsg = "";
                errorMsg += row.ToErrorString(ColorUtil.AddColorTag(data.Key, Color.red) + "  is already contains");
                Debug.LogError(errorMsg);
            }
            return(null);
        }
Пример #8
0
        /// <summary>
        /// エラー用の文字列を取得
        /// </summary>
        /// <param name="msg">エラーメッセージ</param>
        /// <returns>エラー用のテキスト</returns>
        public string ToErrorString(string msg)
        {
            if (!msg.EndsWith("\n"))
            {
                msg += "\n";
            }
            int    lineNo    = rowIndex + 1;
            string sheetName = Grid.SheetName;

            return(msg
                   + sheetName + ":" + lineNo + " " + ColorUtil.AddColorTag(ToDebugString(), Color.red) + "\n"
                   + "<b>" + Grid.Name + "</b>" + "  : " + lineNo);
        }
        /// <summary>
        /// エラー用の文字列を取得
        /// </summary>
        /// <param name="msg">エラーメッセージ</param>
        /// <returns>エラー用のテキスト</returns>
        public string ToErrorString(string msg)
        {
            if (!msg.EndsWith("\n"))
            {
                msg += "\n";
            }
            int    lineNo         = rowIndex + 1;
            int    sheetnameIndex = Grid.Name.LastIndexOf(":");
            string sheetName      = Grid.Name;

            if (sheetnameIndex > 0)
            {
                sheetName = sheetName.Remove(0, sheetnameIndex + 1);
            }
            return(msg
                   + sheetName + ":" + lineNo + " " + ColorUtil.AddColorTag(ToDebugString(), Color.red) + "\n"
                   + "<b>" + Grid.Name + "</b>" + "  : " + lineNo);
        }
Пример #10
0
        //連続するデータとして追加できる場合はする。基本はしない
        protected virtual T ParseFromStringGridRow(T last, StringGridRow row)
        {
            T data = new T();

            if (data.InitFromStringGridRowMain(row))
            {
                if (!Dictionary.ContainsKey(data.Key))
                {
                    Add(data);
                    return(data);
                }
                else
                {
                    string errorMsg = "";
                    errorMsg += row.ToErrorString(ColorUtil.AddColorTag(data.Key, Color.red) + "  is already contains");
                    Debug.LogError(errorMsg);
                }
            }
            return(null);
        }
        protected override AdvCharacterSettingData ParseFromStringGridRow(AdvCharacterSettingData last, StringGridRow row)
        {
            string name     = AdvParser.ParseCellOptional <string>(row, AdvColumnName.CharacterName, string.Empty);
            string pattern  = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Pattern, string.Empty);
            string nameText = AdvParser.ParseCellOptional <string>(row, AdvColumnName.NameText, string.Empty);

            if (string.IsNullOrEmpty(name))
            {
                if (last == null)
                {
                    Debug.LogError(row.ToErrorString("Not Found Chacter Name"));
                    return(null);
                }
                name = last.Name;
            }
            if (string.IsNullOrEmpty(nameText))
            {
                if ((last != null) && (name == last.Name))
                {
                    nameText = last.NameText;
                }
                else
                {
                    nameText = name;
                }
            }
            AdvCharacterSettingData data = new AdvCharacterSettingData();

            data.Init(name, pattern, nameText, row);
            if (!base.Dictionary.ContainsKey(data.Key))
            {
                base.AddData(data);
                if (!this.defaultKey.ContainsKey(name))
                {
                    this.defaultKey.Add(name, data.Key);
                }
                return(data);
            }
            Debug.LogError(string.Empty + row.ToErrorString(ColorUtil.AddColorTag(data.Key, Color.get_red()) + "  is already contains"));
            return(null);
        }
Пример #12
0
        public string ToErrorString(string msg)
        {
            if (!msg.EndsWith("\n"))
            {
                msg = msg + "\n";
            }
            int num = this.DebugIndex + 1;

            if (string.IsNullOrEmpty(this.DebugInfo))
            {
                string   sheetName = this.Grid.SheetName;
                string   str2      = msg;
                object[] objArray1 = new object[] { str2, sheetName, ":", num, " " };
                msg = string.Concat(objArray1);
            }
            else
            {
                msg = msg + this.DebugInfo;
            }
            object[] objArray2 = new object[] { msg, ColorUtil.AddColorTag(this.ToDebugString(), Color.get_red()), "\n<b>", this.Grid.Name, "</b>  : ", num };
            return(string.Concat(objArray2));
        }
Пример #13
0
        /// <summary>
        /// エラー用の文字列を取得
        /// </summary>
        /// <param name="msg">エラーメッセージ</param>
        /// <returns>エラー用のテキスト</returns>
        public string ToErrorString(string msg)
        {
            if (!msg.EndsWith("\n"))
            {
                msg += "\n";
            }

            //デバッグ用の行番号
            int lineNo = this.DebugIndex + 1;

            if (string.IsNullOrEmpty(this.DebugInfo))
            {
                string sheetName = Grid.SheetName;
                msg += sheetName + ":" + lineNo + " ";
            }
            else
            {
                msg += this.DebugInfo;
            }
            return(msg
                   + ColorUtil.AddColorTag(ToDebugString(), Color.red) + "\n"
                   + "<b>" + Grid.Name + "</b>" + "  : " + lineNo);
        }
Пример #14
0
        /// <summary>
        /// エラー用の文字列を取得
        /// </summary>
        /// <param name="msg">エラーメッセージ</param>
        /// <returns>エラー用のテキスト</returns>
        public string ToErrorString(string msg)
        {
            if (!msg.EndsWith("\n"))
            {
                msg += "\n";
            }

            int lineNo = rowIndex + 1;

            if (Grid.Macro == null)
            {
                string sheetName = Grid.SheetName;
                msg += sheetName + ":" + lineNo + " ";
            }
            else
            {
                string sheetName = Grid.Macro.args.Grid.SheetName;
                msg += sheetName + ":" + (Grid.Macro.args.rowIndex + 1) + " ";
            }
            return(msg
                   + ColorUtil.AddColorTag(ToDebugString(), Color.red) + "\n"
                   + "<b>" + Grid.Name + "</b>" + "  : " + lineNo);
        }
Пример #15
0
        //末尾の空白文字をチェック
        private void CheckWhiteSpaceEndOfCell(Dictionary <string, StringGridDictionary> bookDictionary)
        {
            AdvEditorSettingWindow editorSetting = AdvEditorSettingWindow.GetInstance();

            if (UnityEngine.Object.ReferenceEquals(editorSetting, null))
            {
                return;
            }
            if (!editorSetting.CheckWhiteSpaceOnImport)
            {
                return;
            }

            List <string> ignoreHeader = new List <string>();

            ignoreHeader.Add("Text");
            if (LanguageManagerBase.Instance != null)
            {
                foreach (string language in LanguageManagerBase.Instance.Languages)
                {
                    ignoreHeader.Add(language);
                }
            }

            foreach (StringGridDictionary book in bookDictionary.Values)
            {
                foreach (var sheet in book.Values)
                {
                    List <int> ignoreIndex = new List <int>();
                    foreach (var item in ignoreHeader)
                    {
                        int index;
                        if (sheet.Grid.TryGetColumnIndex(item, out index))
                        {
                            ignoreIndex.Add(index);
                        }
                    }
                    foreach (var row in sheet.Grid.Rows)
                    {
                        if (row.RowIndex == 0)
                        {
                            continue;
                        }

                        for (int i = 0; i < row.Strings.Length; ++i)
                        {
                            string str = row.Strings[i];
                            if (str.Length <= 0)
                            {
                                continue;
                            }
                            if (ignoreIndex.Contains(i))
                            {
                                continue;
                            }

                            int endIndex = str.Length - 1;
                            if (char.IsWhiteSpace(str[endIndex]))
                            {
                                Debug.LogWarning(row.ToErrorString("Last characer is white space [" + ColorUtil.AddColorTag(str, ColorUtil.Red) + "]  \n"));
                            }
                        }
                    }
                }
            }
        }