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(); }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; SetTitle("EditText"); SetAttrName(_nodeAttr.GetAttrName()); SetDefaultText(_nodeAttr.GetValueString()); _inputField.ActivateInputField(); }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; if (!int.TryParse(_nodeAttr.GetValueString(), out _enemyId)) { _enemyId = 0; } UpdateSelectStyle(); }
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(); }
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" : "")); }
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())); }
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); }
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); }
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())); } }
/// <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(); }
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())); } }
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); }
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); }
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(); }
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); }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; InitItemsCount(); AddListeners(); }
public override void OnClose() { _itemList[_curSelectedItemIndex].selectImgGo.SetActive(false); _nodeAttr = null; }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; UpdateGroupItems(); AddListeners(); }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; InitParas(); }
public override void OnShow(object data) { _nodeAttr = data as BaseNodeAttr; UpdateEliminatedTypesItems(); }
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!"); }