Beispiel #1
0
        public override void OnClickView(VBase view)
        {
            View.Common.Bind.VBindList vBindList = view.transform.parent.GetComponent <View.Common.Bind.VBindList>();
            VBaseListChild             child     = view as VBaseListChild;

            Model.Character.MCharacter mCharacter = child.model as Model.Character.MCharacter;
            if (vBindList.BindPath == "selectedCharacters")
            {
                mCharacter = System.Array.Find(Global.SUser.self.characters, chara => chara.characterId == mCharacter.characterId);
            }
            if (mCharacter.isSelected == 0 && selectedCharacters.Count == battleFieldMaster.owns.Length)
            {
                return;
            }
            mCharacter.isSelected = mCharacter.isSelected == 0 ? 1 : 0;
            child.UpdateView(mCharacter);
            if (mCharacter.isSelected == 1)
            {
                selectedCharacters.Add(mCharacter.Clone());
            }
            else
            {
                selectedCharacters.RemoveAt(selectedCharacters.FindIndex(chara => chara.characterId == mCharacter.characterId));
            }
            this.dispatcher.Set("selectedCharacters", selectedCharacters.ToArray());
            this.dispatcher.Notify();
        }
Beispiel #2
0
        public override void OnClickView(VBase view)
        {
            Debug.LogError("OnClickView " + view);
            VBaseListChild childView = view.GetComponent <VBaseListChild>();

            this.dispatcher.Set("currentCharacter", childView.model);
            this.dispatcher.Notify();
        }
Beispiel #3
0
        public void ShowContentFromIndex(int index)
        {
            System.Array.ForEach(contents, _ => _.gameObject.SetActive(false));
            if (index >= contents.Length)
            {
                index = 0;
            }
            VBase view = contents[index];

            currentContent = view.gameObject;
            currentContent.SetActive(true);
            if (view is VCharacterStatus)
            {
                view.UpdateView();
            }
        }
Beispiel #4
0
 public override void Awake()
 {
     if (this.target)
     {
         _targetView = target.GetComponent <VBaseListChild>();
         if (_targetView)
         {
             (_targetView as VBaseListChild).AddSubBindView(this);
             return;
         }
         else
         {
             _targetView = target.GetComponent <VBase>();
         }
     }
     base.Awake();
 }
Beispiel #5
0
 private static void ErrorInfo(int i, VBase b, string s)
 {
     Debug.LogWarning("第" + i + "个参数,转换类型为" + b.state + "的值" + b.value + "存在问题,请更改为合适的值:" + s);
 }
Beispiel #6
0
    private object[] GetArgs()
    {
        object[] args = new object[values.Count];
        for (int i = 0; i < values.Count; i++)
        {
            VBase b = values[i];
            switch (b.state)
            {
            case VToolState.Int:
                int a;
                if (int.TryParse(b.value, out a))
                {
                    args[i] = a;
                }
                else
                {
                    ErrorInfo(i, b, "整数");
                }

                break;

            case VToolState.Bool:
                bool value;
                if (bool.TryParse(b.value, out value))
                {
                    args[i] = value;
                }
                else
                {
                    ErrorInfo(i, b, "0或1");
                }

                break;

            case VToolState.String:
                args[i] = b.value;
                break;

            case VToolState.Float:
                float f;
                if (float.TryParse(b.value, out f))
                {
                    args[i] = f;
                }
                else
                {
                    ErrorInfo(i, b, "浮点类型");
                }
                break;

            case VToolState.Vector:
                Vector3   v;
                string [] temp = b.value.Split(',');
                if (float.TryParse(temp[0], out v.x) || float.TryParse(temp[1], out v.y) || float.TryParse(temp[2], out v.z))
                {
                    v.x     = float.Parse(temp[0]);
                    v.y     = float.Parse(temp[1]);
                    v.z     = float.Parse(temp[2]);
                    args[i] = v;
                }
                else
                {
                    ErrorInfo(i, b, "浮点类型");
                }
                break;

            default:
                break;
            }
        }
        return(args);
    }
Beispiel #7
0
 public virtual void OnClickView(VBase view)
 {
 }
Beispiel #8
0
 public override void Awake()
 {
     base.Awake();
     vBase = GetComponent <VBase>();
 }