Beispiel #1
0
        private void DrawSkillEffect(float width, float height)
        {
            EDLayout.CreateScrollView(ref effectPos, "", width, height, (float wid, float hei) =>
            {
                EDLayout.CreateVertical("GroupBox", wid * 0.9f, 55, (float wid01, float hei01) => {
                    //特效列表
                    for (int i = 0; i < SelSkill.Effects.Count; i++)
                    {
                        int selIndex    = i;
                        object conValue = SelSkill.Effects[i].Time;
                        EDTypeField.CreateTypeField("特效播放时间:", ref conValue, typeof(double), wid01, 25);
                        SelSkill.Effects[i].Time = double.Parse(conValue.ToString());

                        //特效Id
                        object idValue = SelSkill.Effects[i].EffectId;
                        EDTypeField.CreateTypeField("特效Id:", ref idValue, typeof(int), wid01, 25);
                        SelSkill.Effects[i].EffectId = int.Parse(idValue.ToString());

                        //特效位置
                        object value = LCConvert.StrChangeToObject(SelSkill.Effects[i].Pos, typeof(Vector3).FullName);
                        EDTypeField.CreateTypeField("特效位置:", ref value, typeof(Vector3), width, 25);
                        SelSkill.Effects[i].Pos = value.ToString();

                        EDButton.CreateBtn("删除特效", wid01, 25, () => {
                            SelSkill.Effects.RemoveAt(selIndex);
                        });
                    }
                });

                EDButton.CreateBtn("添加特效", wid * 0.9f, 25, () => {
                    SelSkill.Effects.Add(new SkillEffectJson());
                });
            });
        }
Beispiel #2
0
        //创建节点
        public static Node CreateNodeInstance(NodeDataJson node)
        {
            if (string.IsNullOrEmpty(node.TypeFullName))
            {
                return(null);
            }

            Node rootNode = LCReflect.CreateInstanceByType <Node>(node.TypeFullName);

            rootNode.Init(node.NodeId, node.Type, node.ChildMaxCnt);
            if (node.Premise != null)
            {
                NodePremise premise = LCReflect.CreateInstanceByType <NodePremise>(node.Premise.TypeFullName);
                premise.Init(rootNode.GetHashCode(), node.Premise.Type, node.Premise.TrueValue);

                if (node.Premise.OtherPremise != null)
                {
                    CreateNodePremise(rootNode.GetHashCode(), premise, node.Premise.OtherPremise);
                }

                rootNode.SetPremise(premise);
            }

            //属性设置
            for (int i = 0; i < node.KeyValues.Count; i++)
            {
                NodeKeyValue keyValue = node.KeyValues[i];
                object       value    = LCConvert.StrChangeToObject(keyValue.Value, keyValue.TypeFullName);
                LCReflect.SetTypeFieldValue(rootNode, keyValue.KeyName, value);
            }
            return(rootNode);
        }
Beispiel #3
0
        private void DrawSkillInfo(float width, float height)
        {
            object conValue = SelSkill.ContinueTime;

            EDTypeField.CreateTypeField("技能持续时间:", ref conValue, typeof(double), width, 25);
            SelSkill.ContinueTime = double.Parse(conValue.ToString());

            object value = LCConvert.StrChangeToObject(SelSkill.Area, typeof(Vector2).FullName);

            EDTypeField.CreateTypeField("技能范围:", ref value, typeof(Vector2), width, 25);
            SelSkill.Area = value.ToString();
        }
Beispiel #4
0
 //特效
 private void PlayEffect(SkillCom skillCom, SkillEffectJson effect)
 {
     if (effect.EffectId <= 0)
     {
         ECSLocate.ECSLog.LogR("特效Id 为空>>>>>>> ", skillCom.SkillId, effect.EffectId);
         return;
     }
     ECSLocate.ECSLog.LogR("播放特效>>>>>>>>>", effect.EffectId);
     ECSLocate.ECS.SetGlobalSingleComData((EffectCom com) =>
     {
         com.CurrShowEffectId = effect.EffectId;
         com.EntityId         = skillCom.EntityId;
         com.ShowPos          = (Vector3)LCConvert.StrChangeToObject(effect.Pos, typeof(Vector3).FullName);
     });
 }
Beispiel #5
0
        private void DrawEditorNodeKeyValue()
        {
            EDLayout.CreateScrollView(ref valuePos, "", mRect.width, mRect.height, ((width, height) =>
            {
                //可编辑键值
                for (int j = 0; j < Json.KeyValues.Count; j++)
                {
                    NodeKeyValue keyValue = Json.KeyValues[j];

                    object value = LCConvert.StrChangeToObject(keyValue.Value, keyValue.TypeFullName);
                    Type ty = LCReflect.GetType(keyValue.TypeFullName);
                    EDTypeField.CreateTypeField(keyValue.KeyName + "= ", ref value, ty, width - 10, 20);

                    keyValue.Value = value.ToString();
                }
            }));
        }
        //组件编辑界面
        private void ShowSelComWindow(float width, float height)
        {
            List <EntityComValueJson> values = UpdateSelComEditorValues();

            EDLayout.CreateScrollView(ref ComValuePos, "Box", width, height, () =>
            {
                for (int i = 0; i < values.Count; i++)
                {
                    EntityComValueJson comView = values[i];
                    Type resType = null;
                    resType      = LCReflect.GetType(comView.Type);
                    if (resType == null)
                    {
                        resType = LCReflect.GetType(comView.Type);
                    }
                    object value = LCConvert.StrChangeToObject(comView.Value, resType.FullName);
                    EDTypeField.CreateTypeField(comView.Name + "= ", ref value, resType, width, 40);
                    SetSelComJson(comView.Name, value.ToString());
                }
            });
        }
Beispiel #7
0
        public Entity CreateProduct(Action <object[]> func, params object[] data)
        {
            //解析参数
            int        entityId   = int.Parse(data[0].ToString());
            string     entityName = data[1].ToString();
            GameObject entityGo   = data.Length > 2?data[2] as GameObject:null;

            //配置数据
            EntityJson entityData = ECSLayerLocate.Info.GetEntityConf(entityName);

            if (entityData == null)
            {
                ECSLocate.ECSLog.LogError("实体配置数据不存在>>>>>>>", entityName);
                return(null);
            }

            //创建实体节点
            if (entityGo == null)
            {
                entityGo = (GameObject)ECSLocate.Factory.GetProduct <Object>(FactoryType.Asset, null, entityData.PrefabPath);
                entityGo = Object.Instantiate(entityGo);
            }
            if (entityGo == null)
            {
                ECSLocate.ECSLog.LogR("有一个实体没有节点>>>>>>>>", entityId, entityName);
            }
            else
            {
#if UNITY_EDITOR
                EntityEditorViewHelp sceneHelp = entityGo.AddComponent <EntityEditorViewHelp>();
                sceneHelp.EntityId = entityId;
#endif
            }

            //创建实体
            Entity entity = new Entity();

            //添加组件
            for (int i = 0; i < entityData.Coms.Count; i++)
            {
                EntityComJson comJson = entityData.Coms[i];
                BaseCom       com     = LCReflect.CreateInstanceByType <BaseCom>(comJson.ComName);

                //赋值
                for (int j = 0; j < comJson.Values.Count; j++)
                {
                    EntityComValueJson valueJson = comJson.Values[j];

                    object value = LCConvert.StrChangeToObject(valueJson.Value, valueJson.Type);
                    LCReflect.SetTypeFieldValue(com, valueJson.Name, value);
                }

                com.Init(entityId, entityGo);
                entity.AddCom(com);
            }

            func?.Invoke(new object[] { entityGo });

            ECSLocate.ECSLog.LogR("创建实体成功>>>>>>>>", entityName);
            return(entity);
        }