Beispiel #1
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);
 }
        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()));
            }
        }
        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()));
            }
        }
        private void InitTypeItems()
        {
            NodeType         nodeType = _nodeAttr.Node.GetNodeType();
            CustomDefineType type     = CustomDefine.GetTypeByNodeType(nodeType);

            _typeNameList = CustomDefine.GetCustomDefineListByType(type);
            for (int i = 0; i < _typeNameList.Count; i++)
            {
                GameObject    item = ResourceManager.GetInstance().GetPrefab("Prefabs/Views/EditViews", "SelectCustomizedTypeItem");
                RectTransform tf   = item.GetComponent <RectTransform>();
                tf.SetParent(_itemContainerTf, false);
                Text typeNameText = tf.Find("CustomizedTypeText").GetComponent <Text>();
                typeNameText.text = _typeNameList[i];
                item.GetComponent <Image>().color = UnSelectedColor;
                int itemIndex = i;
                UIEventListener.Get(item).AddClick(() => {
                    OnItemClickHandler(itemIndex, false);
                });
                _itemList.Add(item);
            }
            // 计算content面板的高度
            float preferredHeight = _typeNameList.Count * 30 + 5;

            _contentPreferredHeight    = preferredHeight < _contentDefaultSize.y ? _contentDefaultSize.y : preferredHeight;
            _itemContainerTf.sizeDelta = new Vector2(_contentDefaultSize.x, _contentPreferredHeight);
            _contentScrollRect.Rebuild(CanvasUpdate.PostLayout);
            _curSelectedItemIndex = -1;
            // 默认选中节点值的那个item,如果没有对应的,则不选中任何一个
            int index = _typeNameList.IndexOf(_nodeAttr.GetValueString());

            OnItemClickHandler(index, true);
        }
        private void InitItemsCount()
        {
            // 清空当前显示
            for (int i = 0; i < _itemList.Count; i++)
            {
                _itemList[i].valueText.text = "";
            }
            string attrValueStr = _nodeAttr.GetValueString();
            // 获取掉落道具的列表
            List <string> paraList;

            if (attrValueStr == "")
            {
                paraList = new List <string>();
            }
            else
            {
                paraList = new List <string>(attrValueStr.Split(','));
            }
            for (int i = 0; i < paraList.Count; i += 2)
            {
                eDropItemType curType  = (eDropItemType)int.Parse(paraList[i]);
                EditItem      editItem = GetEditItemByType(curType);
                editItem.valueText.text = paraList[i + 1];
            }
        }
Beispiel #6
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);
        }
Beispiel #7
0
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     SetTitle("EditText");
     SetAttrName(_nodeAttr.GetAttrName());
     SetDefaultText(_nodeAttr.GetValueString());
     _inputField.ActivateInputField();
 }
Beispiel #8
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);
 }
 public override void OnShow(object data)
 {
     _nodeAttr = data as BaseNodeAttr;
     if (!int.TryParse(_nodeAttr.GetValueString(), out _enemyId))
     {
         _enemyId = 0;
     }
     UpdateSelectStyle();
 }
Beispiel #10
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);
        }
        /// <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 void OnAttributeValueChanged(BaseNodeAttr attr = null)
 {
     // 手动修改引起的参数变更
     // 则更新DefineList
     if (attr != null && attr == GetAttrByIndex(ParamListAttrIndex))
     {
         if ((_parentNode as NodeDefineLaser).IsWatchingData)
         {
             // 参数列表发生变化,修改缓存
             string name = _parentNode.GetAttrByIndex(ParamListAttrIndex).GetValueString();
             CustomDefine.ModifyDefineParaList(CustomDefineType.Laser, name, attr.GetValueString());
         }
     }
     base.OnAttributeValueChanged(attr);
 }
        private void InitParas()
        {
            CustomDefineType type     = CustomDefine.GetTypeByNodeType(_nodeAttr.Node.GetNodeType());
            string           typeName = _nodeAttr.Node.GetAttrByIndex(0).GetValueString();
            CustomDefineData data     = CustomDefine.GetDataByTypeAndName(type, typeName);

            // 获取参数名称的列表
            if (data == null)
            {
                _paraNameList = new List <string>();
            }
            else
            {
                if (data.paraListStr == "")
                {
                    _paraNameList = new List <string>();
                }
                else
                {
                    _paraNameList = new List <string>(data.paraListStr.Split(','));
                }
            }
            // 获取参数值的列表
            List <string> paraValueList = GetParaValuesFromParaStr(_nodeAttr.GetValueString());

            for (int i = 0; i < _paraNameList.Count; i++)
            {
                GameObject    item = ResourceManager.GetInstance().GetPrefab("Prefabs/Views/EditViews", "EditParaItem");
                RectTransform tf   = item.GetComponent <RectTransform>();
                tf.SetParent(_itemContainerTf, false);
                EditParaItem itemSt = new EditParaItem
                {
                    go        = item,
                    valueText = tf.Find("ParaValueField").GetComponent <InputField>(),
                };
                Text paraNameText = tf.Find("ParaNameText").GetComponent <Text>();
                paraNameText.text = _paraNameList[i];
                if (i < paraValueList.Count)
                {
                    itemSt.valueText.text = paraValueList[i];
                }
                else
                {
                    itemSt.valueText.text = "";
                }
                _itemList.Add(itemSt);
            }
        }
 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();
 }
Beispiel #15
0
        private void UpdateEliminatedTypesItems()
        {
            int ignoreGroups = int.Parse(_nodeAttr.GetValueString());
            EliminatedTypesItem item;

            for (int i = 0; i < _defaultTypes.Count; i++)
            {
                int group = (int)_defaultTypes[i];
                item = _itemDic[(eEliminatedTypes)group];
                // 设置
                if ((group & ignoreGroups) != 0)
                {
                    item.toggle.isOn = true;
                }
                else
                {
                    item.toggle.isOn = false;
                }
            }
        }
Beispiel #16
0
        private void UpdateGroupItems()
        {
            int         selectedGroups = int.Parse(_nodeAttr.GetValueString());
            ReboundItem item;

            for (int i = 0; i < _defaultGroups.Count; i++)
            {
                int group = (int)_defaultGroups[i];
                item = _itemDic[(eReboundBorder)group];
                // 设置
                if ((group & selectedGroups) != 0)
                {
                    item.toggle.isOn = true;
                }
                else
                {
                    item.toggle.isOn = false;
                }
            }
        }
Beispiel #17
0
        private void InitRadioItems(string[] datas)
        {
            string    attrValue = _nodeAttr.GetValueString();
            RadioItem item;

            for (int i = 0; i < datas.Length; i++)
            {
                GameObject    itemGo = ResourceManager.GetInstance().GetPrefab("Prefabs/Views/EditViews", "EditRadioItem");
                RectTransform tf     = itemGo.GetComponent <RectTransform>();
                tf.SetParent(_itemContainerTf, false);
                item = new RadioItem
                {
                    go     = itemGo,
                    toggle = tf.Find("Toggle").GetComponent <Toggle>(),
                    value  = datas[i],
                };
                Text valueText = tf.Find("ValueText").GetComponent <Text>();
                valueText.text = datas[i];
                int tmpIndex = i;
                UIEventListener.Get(item.toggle.gameObject).AddClick(() => {
                    if (_curSelectedIndex != -1)
                    {
                        RadioItem tmpItem   = _radioItemList[_curSelectedIndex];
                        tmpItem.toggle.isOn = false;
                    }
                    _curSelectedIndex = tmpIndex;
                });
                _radioItemList.Add(item);
                // 默认选择
                if (attrValue == datas[i])
                {
                    item.toggle.isOn  = true;
                    _curSelectedIndex = i;
                }
            }
        }