Example #1
0
 public static void ShowWindow(string logicDataName, string logicFileUseType)
 {
     StateMachineEditorWindow.OpenWindow();
     LogicSystemEditorWindow.logicDataName    = logicDataName;
     LogicSystemEditorWindow.logicFileUseType = logicFileUseType;
     LogicSystemEditorWindow.Init();
 }
Example #2
0
        public override void EditorOverrideClassGUI()
        {
            Condition_Value_ValueCompare data = (Condition_Value_ValueCompare)target;

            data.internalValueName = LogicSystemAttributeEditorGUI.DrawInternalValueMenu("内部变量名", data.internalValueName, null).ToString();
            if (string.IsNullOrEmpty(data.internalValueName))
            {
                return;
            }
            object        v            = LogicSystemEditorWindow.GetInternalValue(data.internalValueName);
            List <string> compareNames = CompareValue.GetCompareType(v.GetType());

            data.compareType = EditorDrawGUIUtil.DrawPopup("比较类型", data.compareType, compareNames);

            data.useInternalValue = (bool)EditorDrawGUIUtil.DrawBaseValue("使用内部变量", data.useInternalValue);

            if (data.useInternalValue)
            {
                data.compareInternalValueName = LogicSystemAttributeEditorGUI.DrawInternalValueMenu("相比较的内部变量名", data.compareInternalValueName, new string[] { v.GetType().FullName }).ToString();
            }
            else
            {
                if (data.compareBaseValue == null)
                {
                    data.compareBaseValue = new BaseValue("", v);
                }
                if (data.compareBaseValue.typeName != v.GetType().FullName)
                {
                    data.compareBaseValue.SetValue("", v);
                }

                object temp = EditorDrawGUIUtil.DrawBaseValue("比较值(" + data.compareBaseValue.typeName + ")", data.compareBaseValue.GetValue());
                data.compareBaseValue.SetValue("", temp);
            }
        }
        void CreateItem(MessageString ms)
        {
            LogicObject lo = JsonUtils.JsonToClassOrStruct <LogicObject>(ms.value);

            MachineStateGUI      msg = MachineDataController.AddNewMachineStateGUI(new Vector2(500, 450), lo.name, false);
            LogicObjectBehaviour be  = new LogicObjectBehaviour();

            be.logicObj = lo;
            msg.state.stateBaseBehaviours.Add(be);
            msg.name = lo.name;
            LogicSystemEditorWindow.AddLogicObject(lo);
        }
Example #4
0
        public override void Update()
        {
            if (temp <= 0)
            {
                temp = updateTime;

                LogicSystemEditorWindow.UpdateStateDataInfo();
            }
            else
            {
                temp -= deltaTime;
            }
        }
        void DrawAllFileGUI()
        {
            List <string> nameList = new List <string>(dataNameDic.Keys);

            if (nameList.Count == 0)
            {
                return;
            }

            GUILayout.BeginHorizontal();
            selectName = EditorDrawGUIUtil.DrawPopup("类型:", selectName, nameList);
            //添加新类型
            if (!isNewOne && GUILayout.Button("+", GUILayout.Width(30)))
            {
                isNewOne = !isNewOne;
            }
            if (isNewOne)
            {
                newName = EditorDrawGUIUtil.DrawBaseValue("新建名字:", newName).ToString();
                if (GUILayout.Button("确定", GUILayout.Width(60)))
                {
                    if (string.IsNullOrEmpty(newName) || ResourcePathManager.ContainsFileName(newName) || dataNameDic[selectName].Contains(newName))
                    {
                        EditorUtility.DisplayDialog("错误", "名字不能重复或为空", "OK");
                        return;
                    }
                    dataNameDic[selectName].Add(newName);
                    isNewOne = false;
                }
                if (GUILayout.Button("取消", GUILayout.Width(60)))
                {
                    isNewOne = false;
                }
            }
            //删除该类型
            if (!isNewOne && GUILayout.Button("-", GUILayout.Width(30)))
            {
                if (EditorUtility.DisplayDialog("警告", "是否删除类型:" + selectName, "OK", "Cancel"))
                {
                    ms.RemoveItem(selectName);
                    Init();
                    return;
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.Space(8);

            scrollViewPos = GUILayout.BeginScrollView(scrollViewPos, true, true);

            foreach (string name in dataNameDic[selectName])
            {
                if (name == editFileName)
                {
                    GUI.color = Color.red;
                }
                GUILayout.BeginVertical("box");
                GUILayout.BeginHorizontal();
                GUILayout.Label("文件名:" + name);
                if (GUILayout.Button("编辑", GUILayout.Width(60)))
                {
                    LogicSystemEditorWindow.ShowWindow(name, selectName);
                    editFileName = name;
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(9);
                if (GUILayout.Button("移除", GUILayout.Width(70)))
                {
                    if (EditorUtility.DisplayDialog("警告", "是否确定删除文件" + name, "OK", "Cancel"))
                    {
                        Debug.Log(name);
                        ResourcePathManager.DeleteResouceFile(name);
                        dataNameDic[selectName].Remove(name);
                    }

                    return;
                }
                GUILayout.EndVertical();

                GUI.color = oldColor;
            }

            GUILayout.EndScrollView();
        }