Пример #1
0
 //ローカライズテキストデータが何らかの言語に存在するか?
 bool ContainsLocalizeText(StringGridRow row, string defaultColumnName)
 {
     if (!row.IsEmptyCell(defaultColumnName))
     {
         return(true);
     }
     foreach (var column in TextColumnLanguages)
     {
         if (!row.IsEmptyCell(column))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
 private void AddEvent(PropertyType propertyType, List <float> timeTbl, StringGridRow row)
 {
     for (int i = 0; i < row.Strings.Length; i++)
     {
         if ((i != 0) && !row.IsEmptyCell(i))
         {
             AnimationEvent event2 = new AnimationEvent();
             if (propertyType == PropertyType.Texture)
             {
                 string str;
                 if (!row.TryParseCell <string>(i, out str))
                 {
                     continue;
                 }
                 event2.set_functionName("ChangePattern");
                 event2.set_stringParameter(str);
                 event2.set_time(timeTbl[i - 1]);
             }
             if (Application.get_isPlaying())
             {
                 this.Clip.AddEvent(event2);
             }
         }
     }
 }
Пример #3
0
        AnimationCurve ParseCurve(List <float> timeTbl, StringGridRow row)
        {
            // AnimationCurveの生成.
            AnimationCurve curve = new AnimationCurve();

            for (int i = 0; i < row.Strings.Length; ++i)
            {
                if (i == 0)
                {
                    continue;
                }
                if (row.IsEmptyCell(i))
                {
                    continue;
                }

                float value;
                if (!row.TryParseCell <float>(i, out value))
                {
                    continue;
                }
                //キーの追加
//				Debug.Log("AddKey " + timeTbl[i - 1] + " " + value);
                curve.AddKey(new Keyframe(timeTbl[i - 1], value));
            }
            if (curve.keys.Length <= 1)
            {
//				Debug.LogError(row.ToErrorString("Need more than 2 key data"));
            }
            return(curve);
        }
Пример #4
0
        void AddEvent(PropertyType propertyType, List <float> timeTbl, StringGridRow row)
        {
            for (int i = 0; i < row.Strings.Length; ++i)
            {
                if (i == 0)
                {
                    continue;
                }
                if (row.IsEmptyCell(i))
                {
                    continue;
                }

                //キーの追加
                AnimationEvent e = new AnimationEvent();
                // AnimationCurveの生成.
                switch (propertyType)
                {
                case PropertyType.Texture:
                {
                    string value;
                    if (!row.TryParseCell <string>(i, out value))
                    {
                        continue;
                    }
                    e.functionName    = "ChangePattern";
                    e.stringParameter = value;
                    e.time            = timeTbl[i - 1];
                    break;
                }

                case PropertyType.Pattern:
                {
                    string value;
                    if (!row.TryParseCell <string>(i, out value))
                    {
                        continue;
                    }
                    e.functionName    = "ChangePatternAnimation";
                    e.stringParameter = value;
                    e.time            = timeTbl[i - 1];
                    break;
                }
                }
                if (Application.isPlaying)
                {
                    Clip.AddEvent(e);
                }
                else
                {
#if UNITY_EDITOR
//					UnityEditor.AnimationUtility. Clip.AddEvent(e);
#endif
                }
            }
        }
Пример #5
0
 internal bool TryParse(StringGridRow row, int index)
 {
     try
     {
         this.DataList.Clear();
         while ((index + 1) < row.Strings.Length)
         {
             if (row.IsEmptyCell(index) && row.IsEmptyCell((int)(index + 1)))
             {
                 break;
             }
             string name     = row.ParseCell <string>(index++);
             float  duration = row.ParseCell <float>(index++);
             this.DataList.Add(new Data(duration, name));
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #6
0
 internal bool TryParse(StringGridRow row, int index)
 {
     try
     {
         DataList.Clear();
         while (index + 1 < row.Strings.Length)
         {
             if (row.IsEmptyCell(index) && row.IsEmptyCell(index + 1))
             {
                 break;
             }
             string str  = row.ParseCell <string>(index++);
             float  time = row.ParseCell <float>(index++);
             DataList.Add(new Data(time, str));
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #7
0
        //現在の設定言語にローカライズされたテキストを取得
        string ParseCellLocalizedTextByNoSwap(StringGridRow row, string defaultColumnName)
        {
            string columnName = GetLocalizedColumnName(defaultColumnName);

            if (!row.Grid.ContainsColumn(columnName))
            {
                Debug.LogError(row.ToErrorString(columnName + " is empty column. Set localize text column"));
                return("");
            }

            if (this.BlankTextType == LanguageBlankTextType.NoBlankText)
            {
                //テキストセルの内容が空で、PageCtrlの設定もない場合はエラーを出す
                if (row.IsEmptyCell(columnName) && row.IsEmptyCell(AdvColumnName.PageCtrl.QuickToString()))
                {
                    Debug.LogError(row.ToErrorString(columnName + " is empty cell. Set localize text"));
                    return("");
                }
            }

            //指定の言語を
            return(row.ParseCellOptional <string>(columnName, ""));
        }
Пример #8
0
        private AnimationCurve ParseCurve(List <float> timeTbl, StringGridRow row)
        {
            AnimationCurve curve = new AnimationCurve();

            for (int i = 0; i < row.Strings.Length; i++)
            {
                float num2;
                if (((i != 0) && !row.IsEmptyCell(i)) && row.TryParseCell <float>(i, out num2))
                {
                    curve.AddKey(new Keyframe(timeTbl[i - 1], num2));
                }
            }
            if (curve.get_keys().Length <= 1)
            {
            }
            return(curve);
        }
Пример #9
0
        //現在の設定言語にローカライズされたテキストを取得
        string ParseCellLocalizedTextBySwapDefaultLanguage(StringGridRow row, string defaultColumnName)
        {
            string columnName = defaultColumnName;

            if (row.Grid.ContainsColumn(CurrentLanguage))
            {
                //現在の言語があるなら、その列を
                columnName = currentLanguage;
            }
            else
            {
                if (DataLanguage == CurrentLanguage)
                {
                    columnName = defaultColumnName;
                }
                else if (!string.IsNullOrEmpty(DefaultLanguage))
                {
                    columnName = DefaultLanguage;
                }
                else
                {
                    if (!string.IsNullOrEmpty(DataLanguage))
                    {
                        if (CurrentLanguage == DataLanguage)
                        {
                            //「DataLanguage」で言語指定がある場合、Text列は指定言語の場合にのみ表示されるようになります。
                            columnName = defaultColumnName;
                        }
                        else
                        {
                            //DefaultLanguageの列のテキストが基本の表示テキストとして使用されます。
                            columnName = DefaultLanguage;
                        }
                    }
                }
            }
            if (row.IsEmptyCell(columnName))
            {               //指定の言語が空なら、デフォルトのText列を
                //(DefaultLanguageの列のテキストが空の場合は、やはりText列のテキストを表示)
                return(row.ParseCellOptional <string>(defaultColumnName, ""));
            }
            else
            {               //指定の言語を
                return(row.ParseCellOptional <string>(columnName, ""));
            }
        }
Пример #10
0
        //ローカライズ対象のテキスト系コマンドデータが空か?
        public bool IsEmptyTextCommand(StringGridRow row)
        {
            switch (this.BlankTextType)
            {
            case LanguageBlankTextType.NoBlankText:
            case LanguageBlankTextType.AllowBlankText:
                foreach (var column in TextColumnLanguages)
                {
                    if (!row.IsEmptyCell(column))
                    {
                        return(false);
                    }
                }
                return(true);

            default:
                return(true);
            }
        }
Пример #11
0
        //現在の設定言語にローカライズされたテキストを取得
        public static string ParseCellLocalizedText(StringGridRow row, string defaultColumnName)
        {
            string columnName = defaultColumnName;

            if (LanguageManager.Instance != null)
            {
                string currentLanguage = LanguageManager.Instance.CurrentLanguage;
                if (row.Grid.ContainsColumn(currentLanguage))
                {
                    //現在の言語があるなら、その列を
                    columnName = currentLanguage;
                }
                else
                {
                    //デフォルトデータの言語指定がある場合、
                    //現在の言語とデフォルトデータの言語が違う場合、
                    string dataLanguage = LanguageManager.Instance.DataLanguage;
                    if (!string.IsNullOrEmpty(dataLanguage))
                    {
                        if (currentLanguage == dataLanguage)
                        {
                            columnName = defaultColumnName;
                        }
                        else
                        {
                            columnName = LanguageManager.Instance.DefaultLanguage;
                        }
                    }
                }
            }
            if (row.IsEmptyCell(columnName))
            {               //指定の言語が空なら、デフォルトのText列を
                return(row.ParseCellOptional <string>(defaultColumnName, ""));
            }
            else
            {               //指定の言語を
                return(row.ParseCellOptional <string>(columnName, ""));
            }
        }
Пример #12
0
 //セルが空かどうか
 public static bool IsEmptyCell(StringGridRow row, AdvColumnName name)
 {
     return(row.IsEmptyCell(Localize(name)));
 }