Exemple #1
0
        protected void updateView()
        {
            this.removeAllChildren();
            if (vo.isEmpty)
            {
                return;
            }
            updateEventConnectionUI();
            ISkillEvent       skillEvent = vo.evt;
            EditorToggleGroup box;

            box      = new EditorToggleGroup();
            box.data = skillEvent;
            box.addEventListener(EventX.CHANGE, toggleHandle);
            box.addEventListener(EventX.REPAINT, itemRepaintHandle);
            Type type;

            if (eventMaping.TryGetValue(skillEvent.GetType(), out type))
            {
                IEventUI ui = Activator.CreateInstance(type) as IEventUI;
                box.label  = ui.label;
                box.toggle = skillEvent.enabled;
                ui.createUI(skillEvent, box);
            }

            EditorButton btn = new EditorButton("delete");

            btn.style = EditorStyles.miniButton;
            btn.data  = skillEvent;
            btn.addEventListener(EventX.ITEM_CLICK, deleteHandle);
            box.addChild(btn);

            this.addChild(box);
        }
        private void skillItemClickHandle(EventX e)
        {
            EditorButton btn  = e.target as EditorButton;
            string       file = (string)btn.data;

            if (File.Exists(file))
            {
                load(file);
            }
            else
            {
                ShowNotification("文件不存在");
            }
        }
        //private List<string> relevancySkilList=new List<string>();
        public void searchSkillListBy(string fileName)
        {
            skillListBox.removeAllChildren();

            string path = _configPath + fileName;

            if (Directory.Exists(path) == false)
            {
                path = _configPath + StringUtil.trimDig(fileName);
                if (Directory.Exists(path) == false)
                {
                    return;
                }
            }

            EditorBox lineBox = new EditorBox(false);

            skillListBox.addChild(lineBox);

            List <string> extendsList = new List <string>();

            extendsList.Add("*.amf");
            List <string> files = FileHelper.FindFile(path, extendsList);

            int totalWidth = 0;

            foreach (string file in files)
            {
                string  name     = Path.GetFileNameWithoutExtension(file);
                Vector2 playSize = GUI.skin.button.CalcSize(new GUIContent(name));
                totalWidth += (int)playSize.x;

                EditorButton btn = new EditorButton(name);
                btn.expandWidth = false;
                btn.addEventListener(EventX.ITEM_CLICK, skillItemClickHandle);
                btn.data = file;
                lineBox.addChild(btn);

                if (totalWidth > stage.stageWidth - 650)
                {
                    totalWidth = 0;
                    lineBox    = new EditorBox(false);
                    skillListBox.addChild(lineBox);
                }
            }
        }
Exemple #4
0
        private void deleteHandle(EventX e)
        {
            bool b = EditorUtility.DisplayDialog("提示", "确定要删除", "是", "否");

            if (b)
            {
                EditorButton eui       = e.target as EditorButton;
                SkillEvent   skilEvent = eui.data as SkillEvent;

                if (vo != null)
                {
                    vo.removeEvent(skilEvent);
                }

                Undo.RecordObject(this.window, "delete SkillEvent");
                updateView();
            }
        }
Exemple #5
0
        protected override void initialization()
        {
            base.initialization();

            this.titleContent = new GUIContent("Upk");

            this.maxSize = new Vector2(200, 300);
            EditorConfigUtils.load();
            EditorButton btn = new EditorButton("选择");

            btn.addEventListener(EventX.ITEM_CLICK, start);
            this.addChild(btn);


            btn = new EditorButton("选择2(深度遍历子文件夹)");
            btn.addEventListener(EventX.ITEM_CLICK, start2);
            this.addChild(btn);
        }
        protected override void initialization()
        {
            base.initialization();

            BaseRigsterUtils.init();

            this.titleContent = new GUIContent("技能");

            EditorConfigUtils.load();
            resourcePath = EditorConfigUtils.ProjectResource;
            resourcePath = resourcePath.Replace("\\", "/");

            string basePrefabPath = "";

            PathDefine.effectPath = "file:///" + basePrefabPath;
            PathDefine.avatarPath = "file:///" + basePrefabPath;
            PathDefine.scenePath  = "file:///" + basePrefabPath;
            PathDefine.soundPath  = "file:///" + basePrefabPath;

            EditorBox vbox = new EditorBox();

            vbox.widthOption = GUILayout.Width(300);
            vbox.styleString = "box";

            tabNav = new EditorTabNav();
            tabNav.addEventListener(EventX.CHANGE, tabNavHandle);
            modelWindow = new ModelWindow();
            modelWindow.addEventListener(EventX.SELECT, modelSelectHandle);
            tabNav.addItem("avatar", modelWindow);

            effectWindow = new ModelWindow();
            effectWindow.addEventListener(EventX.SELECT, effectSelectHandle);
            tabNav.addItem("effect", effectWindow);

            soundWindow           = new ModelWindow();
            soundWindow.exNameArr = new[] { "*.mp3", "*.ogg", "*.wav" };
            soundWindow.addEventListener(EventX.SELECT, soundSelectHandle);
            tabNav.addItem("sound", soundWindow);


            EditorBox    box = new EditorBox(false);
            EditorButton btn;

            btn = new EditorButton("reload");
            btn.addEventListener(EventX.ITEM_CLICK, reload);
            box.addChild(btn);


            btn = new EditorButton("updateSVN");
            btn.addEventListener(EventX.ITEM_CLICK, updateSVN);
            box.addChild(btn);

            btn = new EditorButton("editor");
            btn.addEventListener(EventX.ITEM_CLICK, editor);
            box.addChild(btn);
            autoMononType = new EditorFormItem("自动代码");
            autoMononType.addEventListener(EventX.CHANGE, autoMononTypeHandle);
            autoMononType.value = autoMononTypeName;

            vbox.addChild(tabNav);
            vbox.addChild(new EditorFlexibleSpace());
            vbox.addChild(autoMononType);
            vbox.addChild(box);

            btn = new EditorButton("打包Assetbundle");
            btn.addEventListener(EventX.ITEM_CLICK, assetbundleClickHandle);
            vbox.addChild(btn);

            addChild(vbox);

            propertyWindow             = new PropertyWindow();
            propertyWindow.widthOption = GUILayout.Width(300);
            timeWindow = new TimeWindow();
            timeWindow.addEventListener(EventX.SELECT, timeLineSelectHandle);
            timeWindow.init(resourcePath + "All/skill/", propertyWindow);

            addChild(timeWindow);

            addChild(propertyWindow);

            reload(null);

            tabNav.selectedIndex      = tabSelectedIndex;
            modelWindow.selectedIndex = modelSelectedIndex;
        }
        public TimeWindow()
        {
            this.styleString = "PreBackground";
            EditorBox box = new EditorBox(false);

            box.styleString = "box";
            EditorButton newButton = new EditorButton("创建");

            newButton.styleString = "ButtonLeft";
            newButton.expandWidth = false;
            newButton.addEventListener(EventX.ITEM_CLICK, newHandle);
            box.addChild(newButton);

            EditorButton button = new EditorButton("加载");

            button.styleString = "ButtonMid";
            button.expandWidth = false;
            button.addEventListener(EventX.ITEM_CLICK, loadHandle);
            box.addChild(button);

            button             = new EditorButton("保存");
            button.styleString = "ButtonMid";
            button.expandWidth = false;
            button.addEventListener(EventX.ITEM_CLICK, saveHandle);
            box.addChild(button);

            button             = new EditorButton("另存");
            button.styleString = "ButtonMid";
            button.expandWidth = false;
            button.addEventListener(EventX.ITEM_CLICK, toSaveHandle);
            box.addChild(button);

            playButton             = new EditorButton("播放");
            playButton.styleString = "ButtonRight";
            playButton.expandWidth = false;
            playButton.addEventListener(EventX.ITEM_CLICK, toggleHandle);
            box.addChild(playButton);

            EditorPlayControlBar cb = new EditorPlayControlBar();

            box.addChild(cb);


            box.addChild(new EditorSpace());

            fileNameButton             = new EditorButton();
            fileNameButton.expandWidth = false;
            fileNameButton.addEventListener(EventX.ITEM_CLICK, openPathHandle);
            box.addChild(fileNameButton);
            fileNameButton.visible = false;

            commitButton             = new EditorButton("提交");
            commitButton.expandWidth = false;
            commitButton.addEventListener(EventX.ITEM_CLICK, commitPathHandle);
            box.addChild(commitButton);
            commitButton.visible = false;


            timeScaleSlider = new EditorSlider("时间缩放");
            timeScaleSlider.setRank(0.1f, 2f, 1.0f);
            timeScaleSlider.widthOption = GUILayout.Width(200);
            timeScaleSlider.addEventListener(EventX.CHANGE, timeScaleHandle);
            box.addChild(timeScaleSlider);

            this.addChild(box);

            EditorButton resetButton = new EditorButton("reset");

            resetButton.expandWidth = false;
            resetButton.addEventListener(EventX.ITEM_CLICK, resetTimeHandle);
            box.addChild(resetButton);

            EditorLabel label = new EditorLabel("fps:" + (int)(1000 / frameTime) + "帧/s");

            box.addChild(label);

            timeLine = new TimeLine();
            timeLine.genericMenuEditorCallBack = genericMenuEditorCallBack;
            timeLine.addMenuEditorCallBack     = addMenuEditorCallBack;
            timeLine.addEventListener(EventX.SELECT, innerDirectDispatchEvent);

            skillListBox = new EditorBox(true);

            this.addChild(timeLine);
            this.addChild(skillListBox);
        }