Exemple #1
0
 public void WriteConstomNumText(string str, string flag, string postfix = "")
 {
     this.matchs = Regex.Matches(str, "\\d\\d*");
     if (this.matchs.Count > 0)
     {
         int      count = this.matchs.Count;
         string[] array = new string[count];
         for (int i = 0; i < count; i++)
         {
             int length = this.matchs[i].Value.Length;
             for (int j = 0; j < length; j++)
             {
                 string[] expr_62_cp_0 = array;
                 int      expr_62_cp_1 = i;
                 expr_62_cp_0[expr_62_cp_1] += DelegateProxy.StringBuilder(new object[]
                 {
                     flag,
                     this.matchs[i].Value[j]
                 });
             }
         }
         string text = string.Empty;
         int    num  = 0;
         for (int k = 0; k < count; k++)
         {
             if (k > 0)
             {
                 num += array[k - 1].Length - this.matchs[k - 1].Value.Length;
                 text = text.Remove(this.matchs[k].Index + num, this.matchs[k].Value.Length);
                 text = text.Insert(this.matchs[k].Index + num, array[k]);
             }
             else
             {
                 text = str.Remove(this.matchs[k].Index, this.matchs[k].Value.Length);
                 text = text.Insert(this.matchs[k].Index, array[k]);
             }
         }
         for (int l = 0; l < text.Length; l++)
         {
             if (text[l] == '+' || text[l] == '-' || text[l] == '=')
             {
                 text = text.Insert(l, flag);
                 int length2 = flag.Length;
                 l += length2;
             }
         }
         text = DelegateProxy.StringBuilder(new object[]
         {
             text,
             postfix
         });
         base.text = text;
     }
 }
Exemple #2
0
    public void UpdateCustomView()
    {
        int num  = 0;
        int num2 = 0;
        int num3 = 0;

        if (this.arrangement == UIGrid.Arrangement.Vertical)
        {
            num3 = (int)(this.mPanel.height / this.cellHeight) + 2;
        }
        else if (this.arrangement == UIGrid.Arrangement.Horizontal)
        {
            num3 = Mathf.FloorToInt(this.mPanel.width / this.cellWidth) + 2;
        }
        int num4 = this.mOffsetRows * this.maxPerLine;
        int num5 = num4 + num3 * this.maxPerLine;

        for (int i = 0; i < this.mDataSource.Count; i++)
        {
            object obj = this.mDataSource[i];
            if (i < num4 || i > num5)
            {
                if (this.mDataToTrans.ContainsKey(obj))
                {
                    Transform transform = this.mDataToTrans[obj];
                    if (transform != null)
                    {
                        transform.gameObject.SetActive(false);
                        this.mFreeTrans.Add(transform);
                    }
                    this.mDataToTrans.Remove(obj);
                }
                if (this.SelectItem != null && this.miSelectIndex == i)
                {
                    this.SelectItem(this.miSelectIndex, false, false);
                }
            }
            else
            {
                int       num6 = i - num4;
                Transform transform2;
                if (this.mDataToTrans.ContainsKey(obj))
                {
                    transform2 = this.mDataToTrans[obj];
                }
                else
                {
                    transform2 = this.GetFreeTrans();
                    if (transform2 == null)
                    {
                        return;
                    }
                    this.mDataToTrans.Add(obj, transform2);
                }
                transform2.name = DelegateProxy.StringBuilder(new object[]
                {
                    "Item",
                    i
                });
                float   z    = transform2.localPosition.z;
                Vector3 zero = Vector3.zero;
                if (this.arrangement == UIGrid.Arrangement.Vertical)
                {
                    zero.x = this.cellWidth * (float)num;
                    zero.y = -this.cellHeight * (float)num2;
                    zero.z = z;
                }
                else
                {
                    zero.x = this.cellWidth * (float)num2;
                    zero.y = -this.cellHeight * (float)num;
                    zero.z = z;
                }
                transform2.localPosition = zero;
                if (!transform2.gameObject.activeSelf)
                {
                    transform2.gameObject.SetActive(true);
                }
                UIGridItem component = transform2.gameObject.GetComponent <UIGridItem>();
                if (component != null)
                {
                    component.setIndex(i);
                    component.onClick = new UIGridItem.VoidDelegate(this.OnClick);
                    component.oData   = obj;
                    this.mfnOnChangeRow(component);
                }
                if (this.SelectItem != null && this.miSelectIndex == i)
                {
                    this.SelectItem(this.miSelectIndex, true, false);
                }
            }
            if (++num >= this.maxPerLine && this.maxPerLine > 0)
            {
                num = 0;
                num2++;
            }
        }
    }
Exemple #3
0
 private void Awake()
 {
     this.mGo        = base.gameObject;
     this.mAnimation = this.mGo.GetComponent <Animation>();
     if (this.mAnimation == null)
     {
         this.mAnimation = this.mGo.AddComponent <Animation>();
     }
     if (this.mAnimation == null)
     {
         return;
     }
     this.mAnimation.playAutomatically = true;
     this.mAnimation.enabled           = false;
     this.mAnimation.enabled           = true;
     if (this.mAnimations == null)
     {
         LogSystem.LogWarning(new object[]
         {
             "mAnimations is NULL " + this.mGo.name
         });
         return;
     }
     for (int i = 0; i < this.mAnimations.Length; i++)
     {
         AnimationProxy.AnimationInfo animationInfo = this.mAnimations[i];
         if (animationInfo != null)
         {
             if (!this.mAnimationMaps.ContainsKey(animationInfo.strName))
             {
                 this.mAnimationMaps.Add(animationInfo.strName, animationInfo.strPath);
             }
         }
     }
     if (this.mAnimations.Length > 0)
     {
         this.configLoaded = true;
     }
     if (!this.mAnimationMaps.ContainsKey(this.mMainClip.strName))
     {
         this.mAnimationMaps.Add(this.mMainClip.strName, this.mMainClip.strPath);
     }
     if (!string.IsNullOrEmpty(this.modelAcionID))
     {
         string strFileName = DelegateProxy.StringBuilder(new object[]
         {
             "Config/AnimationInfos/",
             this.modelAcionID
         });
         DelegateProxy.LoadAsset(strFileName, new AssetCallBack(this.AniInfoAssetLoaded));
     }
     else
     {
         this.OnStart();
         if (this.onAnimationConfigLoaded != null)
         {
             this.onAnimationConfigLoaded(this);
         }
         LogSystem.LogWarning(new object[]
         {
             "Model does not has model action info,",
             this.mGo.name
         });
     }
 }