コード例 #1
0
 public virtual void OnAttributeValueChanged(BaseNodeAttr attr = null)
 {
     // 所有变量一起改变
     if (attr == null)
     {
         CachePreValue();
     }
     else
     {
         List <object> preValues = new List <object>();
         List <object> curValues = new List <object>();
         for (int i = 0; i < _attrs.Count; i++)
         {
             preValues.Add(_preValues[i]);
             curValues.Add(GetAttrByIndex(i).GetValueString());
         }
         OpNodeAttrValuesModificationHM hm = new OpNodeAttrValuesModificationHM
         {
             nodeIndex = NodeManager.GetNodeIndex(this),
             preValues = preValues,
             curValues = curValues,
         };
         Undo.AddToUndoTask(hm);
         CachePreValue();
     }
     UpdateDesc();
 }
コード例 #2
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     SetTitle("EditText");
     SetAttrName(_nodeAttr.GetAttrName());
     SetDefaultText(_nodeAttr.GetValueString());
     _inputField.ActivateInputField();
 }
コード例 #3
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     if (!int.TryParse(_nodeAttr.GetValueString(), out _enemyId))
     {
         _enemyId = 0;
     }
     UpdateSelectStyle();
 }
コード例 #4
0
        public override void OnShow(object data)
        {
            List <object> datas = data as List <object>;

            _nodeAttr = datas[0] as BaseNodeAttr;
            SetTitle(datas[1] as string);
            InitRadioItems(datas[2] as string[]);
            ResizePanel();
        }
コード例 #5
0
        public override string ToDesc()
        {
            BaseNodeAttr aimToPlayerAttr = GetAttrByIndex(3);

            return(string.Format("set {0}'s velocity={1} angle={2} {3}",
                                 GetAttrByIndex(0).GetValueString(),
                                 GetAttrByIndex(1).GetValueString(),
                                 GetAttrByIndex(2).GetValueString(),
                                 GetAttrByIndex(3).GetValueString() == "true" ? "aim to player" : ""));
        }
コード例 #6
0
        public override string ToDesc()
        {
            BaseNodeAttr aimToPlayerAttr = GetAttrByIndex(3);

            return(string.Format("{0} move towards with velocity of {1},angle of {2}{3} in {4} frames",
                                 GetAttrByIndex(0).GetValueString(),
                                 GetAttrByIndex(1).GetValueString(),
                                 GetAttrByIndex(2).GetValueString(),
                                 GetAttrByIndex(3).GetValueString() == "true" ? " aim to player" : "",
                                 GetAttrByIndex(4).GetValueString()));
        }
コード例 #7
0
        public override string ToDesc()
        {
            BaseNodeAttr nodeAttr     = GetAttrByIndex(3);
            string       loopCountStr = nodeAttr.GetValueString() == "" ? "" : " , loopCount = " + nodeAttr.GetValueString();
            string       ret          = "";

            ret = string.Format("{0} play Ani \"{1}\" with {2}{3}",
                                GetAttrByIndex(0).GetValueString(),
                                GetAttrByIndex(1).GetValueString(), GetAttrByIndex(2).GetValueString(),
                                loopCountStr);
            return(ret);
        }
コード例 #8
0
 public override void OnAttributeValueChanged(BaseNodeAttr attr = null)
 {
     if (attr != null)
     {
         if (attr.GetPreValue() == null)
         {
             string newTypeName = attr.GetValueString();
             if (newTypeName != "")
             {
                 BaseNode onCreteNode = GetChildByType(NodeType.OnEnemyCreate);
                 _isWatchingData = CustomDefine.AddData(CustomDefineType.Enemy, newTypeName, onCreteNode.GetAttrByIndex(0).GetValueString());
             }
         }
         else
         {
             string fromName = attr.GetPreValue().ToString();
             if (fromName != "")
             {
                 if (_isWatchingData)
                 {
                     _isWatchingData = CustomDefine.ModifyDefineName(CustomDefineType.Enemy, fromName, attr.GetValueString());
                 }
                 else
                 {
                     BaseNode onCreteNode = GetChildByType(NodeType.OnEnemyCreate);
                     _isWatchingData = CustomDefine.AddData(CustomDefineType.Enemy, attr.GetValueString(), onCreteNode.GetAttrByIndex(0).GetValueString());
                 }
             }
             else
             {
                 string newTypeName = attr.GetValueString();
                 if (newTypeName != "")
                 {
                     BaseNode onCreteNode = GetChildByType(NodeType.OnEnemyCreate);
                     _isWatchingData = CustomDefine.AddData(CustomDefineType.Enemy, newTypeName, onCreteNode.GetAttrByIndex(0).GetValueString());
                 }
             }
         }
     }
     else // 载入节点数据or设置节点默认值时
     {
         string typeName = GetAttrByIndex(0).GetValueString();
         if (typeName != "")
         {
             BaseNode onCreteNode = GetChildByType(NodeType.OnEnemyCreate);
             string   paraList    = onCreteNode.GetAttrByIndex(0).GetValueString();
             _isWatchingData = CustomDefine.AddData(CustomDefineType.Enemy, typeName, paraList);
         }
     }
     base.OnAttributeValueChanged(attr);
 }
コード例 #9
0
        public override string ToLuaHead()
        {
            BaseNodeAttr nameAttr  = GetAttrByIndex(0);
            BaseNodeAttr valueAttr = GetAttrByIndex(1);

            if (valueAttr.GetValueString() == "")
            {
                return(string.Format("local {0}\n", nameAttr.GetValueString()));
            }
            else
            {
                return(string.Format("local {0} = {1}\n", nameAttr.GetValueString(), valueAttr.GetValueString()));
            }
        }
コード例 #10
0
        /// <summary>
        /// data
        /// <para>BulletType type 激光类型</para>
        /// <para>BaseNodeAttr nodeAttr</para>
        /// </summary>
        /// <param name="data"></param>
        public override void OnShow(object data)
        {
            List <object> datas = data as List <object>;

            _showType = (BulletType)datas[0];
            _nodeAttr = datas[1] as BaseNodeAttr;
            _showId   = _nodeAttr.GetValueString();
            if (!int.TryParse(_showId, out _curBulletId))
            {
                _curBulletId = 0;
            }
            _styleCfgs = DatabaseManager.LaserDatabase.GetLaserStyleCfgsByType(_showType);
            InitAllShow();
        }
コード例 #11
0
        public override string ToDesc()
        {
            BaseNodeAttr nameAttr  = GetAttrByIndex(0);
            BaseNodeAttr valueAttr = GetAttrByIndex(1);

            if (valueAttr.GetValueString() == "")
            {
                return(string.Format("define local variable {0}", nameAttr.GetValueString()));
            }
            else
            {
                return(string.Format("define local variable {0} = {1}", nameAttr.GetValueString(), valueAttr.GetValueString()));
            }
        }
コード例 #12
0
 public override void OnAttributeValueChanged(BaseNodeAttr attr = null)
 {
     // 手动修改引起的参数变更
     // 则更新DefineList
     if (attr != null && attr == GetAttrByIndex(ParamListAttrIndex))
     {
         if ((_parentNode as NodeDefineLinearLaser).IsWatchingData)
         {
             // 参数列表发生变化,修改缓存
             string name = _parentNode.GetAttrByIndex(ParamListAttrIndex).GetValueString();
             CustomDefine.ModifyDefineParaList(CustomDefineType.LinearLaser, name, attr.GetValueString());
         }
     }
     base.OnAttributeValueChanged(attr);
 }
コード例 #13
0
 public override void OnAttributeValueChanged(BaseNodeAttr attr = null)
 {
     if (attr != null)
     {
         if (attr.GetPreValue() == null)
         {
             string newTypeName = attr.GetValueString();
             if (newTypeName != "")
             {
                 _isWatchingData = CustomDefine.AddData(CustomDefineType.SpellCard, newTypeName, "");
             }
         }
         else
         {
             string fromName = attr.GetPreValue().ToString();
             if (fromName != "")
             {
                 if (_isWatchingData)
                 {
                     _isWatchingData = CustomDefine.ModifyDefineName(CustomDefineType.SpellCard, fromName, attr.GetValueString());
                 }
                 else
                 {
                     _isWatchingData = CustomDefine.AddData(CustomDefineType.SpellCard, attr.GetValueString(), "");
                 }
             }
             else
             {
                 string newTypeName = attr.GetValueString();
                 if (newTypeName != "")
                 {
                     _isWatchingData = CustomDefine.AddData(CustomDefineType.SpellCard, newTypeName, "");
                 }
             }
         }
     }
     else // 载入节点数据or设置节点默认值时
     {
         string typeName = GetAttrByIndex(0).GetValueString();
         if (typeName != "")
         {
             _isWatchingData = CustomDefine.AddData(CustomDefineType.SpellCard, typeName, "");
         }
     }
     base.OnAttributeValueChanged(attr);
 }
コード例 #14
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     try
     {
         _curBulletId = int.Parse(_nodeAttr.GetValueString());
     }
     catch
     {
         _curBulletId = 0;
     }
     if (_curBulletId == 0 || !CheckColorAvailable(_curBulletId))
     {
         _curBulletId = 107010;
     }
     InitAllShow();
 }
コード例 #15
0
        public override string ToDesc()
        {
            int          endIndex = 1 + VarCount * 3;
            BaseNodeAttr nodeAttr = GetAttrByIndex(0);
            string       ret      = string.Format("repeat {0} times", nodeAttr.GetValueString());

            for (int i = 1; i < endIndex; i = i + 3)
            {
                nodeAttr = GetAttrByIndex(i);
                if (nodeAttr.GetValueString() != "")
                {
                    ret = string.Format("{0} ({1}={2},increment {3})",
                                        ret, GetAttrByIndex(i).GetValueString(), GetAttrByIndex(i + 1).GetValueString(), GetAttrByIndex(i + 2).GetValueString());
                }
            }
            return(ret);
        }
コード例 #16
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     InitItemsCount();
     AddListeners();
 }
コード例 #17
0
 public override void OnClose()
 {
     _itemList[_curSelectedItemIndex].selectImgGo.SetActive(false);
     _nodeAttr = null;
 }
コード例 #18
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     UpdateGroupItems();
     AddListeners();
 }
コード例 #19
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     InitParas();
 }
コード例 #20
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     UpdateEliminatedTypesItems();
 }
コード例 #21
0
        public static BaseNodeAttr CreateNodeAttr(NodeAttrType type)
        {
            BaseNodeAttr nodeAttr = null;

            switch (type)
            {
            case NodeAttrType.Any:
                nodeAttr = new NodeAttrAny();
                break;

            case NodeAttrType.Bool:
                nodeAttr = new NodeAttrBool();
                break;

            case NodeAttrType.BulletId:
                nodeAttr = new NodeAttrBulletId();
                break;

            case NodeAttrType.CustomizedType:
                nodeAttr = new NodeAttrCustomizedBulletType();
                break;

            case NodeAttrType.ParaList:
                nodeAttr = new NodeAttrPara();
                break;

            case NodeAttrType.MoveMode:
                nodeAttr = new NodeAttrMoveMode();
                break;

            case NodeAttrType.SCCondition:
                nodeAttr = new NodeAttrSCCondition();
                break;

            case NodeAttrType.CollisionGroups:
                nodeAttr = new NodeAttrCollisionGroup();
                break;

            case NodeAttrType.ResistEliminatedTypes:
                nodeAttr = new NodeAttrResistEliminatedTypes();
                break;

            case NodeAttrType.PropertyChangeMode:
                nodeAttr = new NodeAttrChangeMode();
                break;

            case NodeAttrType.PropertyType:
                nodeAttr = new NodeAttrPropertyType();
                break;

            case NodeAttrType.BlendMode:
                nodeAttr = new NodeAttrBlendMode();
                break;

            case NodeAttrType.Layer:
                nodeAttr = new NodeAttrLayer();
                break;

            case NodeAttrType.ShapeType:
                nodeAttr = new NodeAttrShapeType();
                break;

            case NodeAttrType.DirectionMode:
                nodeAttr = new NodeAttrDirectionMode();
                break;

            case NodeAttrType.UnitEventType:
                nodeAttr = new NodeAttrUnitEventType();
                break;

            case NodeAttrType.LaserId:
                nodeAttr = new NodeAttrLaserId();
                break;

            case NodeAttrType.EnemyStyle:
                nodeAttr = new NodeAttrSelectEnemyStyle();
                break;

            case NodeAttrType.ReboundBorder:
                nodeAttr = new NodeAttrReboundBorder();
                break;

            case NodeAttrType.DropItems:
                nodeAttr = new NodeAttrDropItems();
                break;

            case NodeAttrType.AniActionType:
                nodeAttr = new NodeAttrAniActionType();
                break;

            case NodeAttrType.Direction:
                nodeAttr = new NodeAttrDirection();
                break;
            }
            if (nodeAttr != null)
            {
                return(nodeAttr);
            }
            throw new Exception("Create nodeAttr fail!Type " + type + " is not exist!");
        }