예제 #1
0
        //清理Json
        private static void ClearJson()
        {
            //实体请求
            for (int i = 0; i < MReqWeightJson.EntityReqWeight.Count; i++)
            {
                WeightJson json = MReqWeightJson.EntityReqWeight[i];

                bool contain = true;
                foreach (int temp in Enum.GetValues(typeof(EntityReqId)))
                {
                    if (json.Key == temp)
                    {
                        contain = true;
                        break;
                    }

                    contain = false;
                }

                if (contain == false)
                {
                    MReqWeightJson.EntityReqWeight.RemoveAt(i);
                }
            }

            //世界请求
            for (int i = 0; i < MReqWeightJson.WorldReqWeight.Count; i++)
            {
                WeightJson json = MReqWeightJson.WorldReqWeight[i];

                bool contain = true;
                foreach (int temp in Enum.GetValues(typeof(WorldReqId)))
                {
                    if (json.Key == temp)
                    {
                        contain = true;
                        break;
                    }

                    contain = false;
                }

                if (contain == false)
                {
                    MReqWeightJson.WorldReqWeight.RemoveAt(i);
                }
            }
        }
예제 #2
0
 private int GetEntityRequestWeight(EntityReqId reqId)
 {
     if (reqWeightConf == null)
     {
         return(0);
     }
     for (int i = 0; i < reqWeightConf.EntityReqWeight.Count; i++)
     {
         WeightJson json = reqWeightConf.EntityReqWeight[i];
         if (json.Key == (int)reqId)
         {
             return(json.Weight);
         }
     }
     ECSLocate.ECSLog.LogR("有实体请求没有设置权重>>>>", reqId.ToString());
     return(0);
 }
예제 #3
0
        private WeightJson GetReqWeightJson(int reqId)
        {
            List <WeightJson> jsons = ShowEntityReq ? MReqWeightJson.EntityReqWeight : MReqWeightJson.WorldReqWeight;

            for (int i = 0; i < jsons.Count; i++)
            {
                WeightJson json = jsons[i];
                if (json.Key == reqId)
                {
                    return(json);
                }
            }

            WeightJson addJson = new WeightJson();

            addJson.Key    = reqId;
            addJson.Weight = 0;
            jsons.Add(addJson);
            return(addJson);
        }
예제 #4
0
        private void DrawReqList()
        {
            EDLayout.CreateScrollView(ref reqPos, "box", position.width, position.height - 20, (() =>
            {
                List <int> showList = GetWeightList();
                for (int i = 0; i < showList.Count; i++)
                {
                    int key = showList[i];
                    string reqName = GetReqIdName(key);

                    WeightJson json = GetReqWeightJson(key);
                    object value = json.Weight;
                    EDTypeField.CreateTypeField(reqName, ref value, typeof(int), position.width, 20);
                    json.Weight = (int)value;

                    EDButton.CreateBtn("强制置换请求权重", 200, 25, (() => { json.Weight = ECSDefinition.REForceSwithWeight; }));

                    EDButton.CreateBtn("请求自身判断置换请求权重", 200, 25, (() => { json.Weight = ECSDefinition.RESwithRuleSelf; }));

                    EDTypeField.CreateLableField("------------------------", "", position.width, 10);
                    EditorGUILayout.Space();
                }
            }));
        }