예제 #1
0
파일: vSlider.cs 프로젝트: Donaim/vutils
        public IManipulator AddWatch(IManipulator m)
        {
            //back:
            //try { this.Invoke((Action)invoked); }
            //catch { Thread.Sleep(100); goto back; }

            while (!IsHandleCreated)
            {
                Thread.Sleep(1);
            }
            this.Invoke((Action)invoked);

            return(m);

            void invoked()
            {
                var newButt = new ButtonCtrl(this, m);

                int topY = STARTY + (newButt.Height + DELTAY) * Controls.Count;

                newButt.Location = new Point(DELTAX, topY);
                Controls.Add(newButt);

                int botY = topY + newButt.Height + DELTAY;

                this.Height = Math.Max(botY + STARTY + 32, Height);
            }
        }
예제 #2
0
 private void Awake()
 {
     this.mInput              = base.transform.Find("InputField").GetComponent <InputField>();
     this.Button_Sure         = base.transform.Find("Button_Sure").GetComponent <ButtonCtrl>();
     this.Button_Sure.onClick = new Action(this.OnButtonClick);
     this.mInput.onValueChanged.AddListener(value => int.TryParse(value, out this.skillid));
 }
예제 #3
0
파일: Button.cs 프로젝트: zuk2014/CRYENGINE
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public override void OnAwake()
        {
            base.OnAwake();
            RectTransform.ClampMode = ClampMode.Full;
            Background.Source       = ResourceManager.ImageFromFile(_backgroundImageUrl, false);
            Background.SliceType    = SliceType.Nine;
            Ctrl = AddComponent <ButtonCtrl> ();

            _frame = SceneObject.Instantiate <Panel>(this);
            _frame.Background.Source       = ResourceManager.ImageFromFile(Application.UIPath + "frame.png", false);
            _frame.Background.SliceType    = SliceType.Nine;
            _frame.Background.Color        = Color.SkyBlue;
            _frame.RectTransform.Alignment = Alignment.Stretch;
            _frame.RectTransform.ClampMode = ClampMode.Full;
            _frame.Active = false;
            _frame.RectTransform.Padding = new Padding(2);

            Ctrl.OnFocusEnter += () =>
            {
                _frame.Active = true;
                SetDown();
            };
            Ctrl.OnFocusLost += () =>
            {
                _frame.Active = false;
                SetUp();
            };
        }
예제 #4
0
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        protected override void OnAwake()
        {
            base.OnAwake();
            RectTransform.ClampMode = ClampMode.Full;
            Background.Source       = ResourceManager.ImageFromFile(_backgroundImageUrl, false);
            Background.SliceType    = SliceType.Nine;
            Ctrl = AddComponent <ButtonCtrl>();

            _frame = Instantiate <Panel>(this);
            _frame.Background.Source       = ResourceManager.ImageFromFile(_frameImageUrl, false);
            _frame.Background.SliceType    = SliceType.Nine;
            _frame.Background.Color        = Color.SkyBlue;
            _frame.RectTransform.Alignment = Alignment.Stretch;
            _frame.RectTransform.ClampMode = ClampMode.Full;
            _frame.Active = false;
            _frame.RectTransform.Padding = new Padding(2);

            Ctrl.OnFocusEnter += () =>
            {
                if (ShowPressedFrame)
                {
                    _frame.Active = true;
                }
                SetDown();
            };

            Ctrl.OnFocusLost += () =>
            {
                _frame.Active = false;
                SetUp();
            };

            Ctrl.OnEnterMouse += SetOver;
            Ctrl.OnLeaveMouse += SetNormal;
        }
예제 #5
0
 void Start()
 {
     instance                  = this;
     m_mainCamera              = Camera.main;
     m_cameraCtrl              = m_mainCamera.GetComponent <CameraCtrl>();
     screenDragTrigger.onDrag += OnScreenDrag;
 }
예제 #6
0
파일: vSlider.cs 프로젝트: Donaim/vutils
                public DescreteZone(ButtonCtrl p)
                {
                    parent = p;

                    CheckForIllegalCrossThreadCalls = false;
                    DoubleBuffered = false;
                    Size           = parent.BottomSize;
                    Location       = new Point(0, parent.Height - this.Height);

                    currBox       = new SmallTBox(this, parent.M.SetCurrent, parent.M.GetCurrentString);
                    currBox.Width = Width / 3;
                    currBox.Left  = 0;
                    this.Controls.Add(currBox);

                    minBox       = new SmallTBox(this, parent.M.SetMin, parent.M.GetMinString);
                    minBox.Width = Width / 5;
                    minBox.Left  = currBox.Right + 5;
                    this.Controls.Add(minBox);
                    maxBox       = new SmallTBox(this, parent.M.SetMax, parent.M.GetMaxString);
                    maxBox.Width = Width / 5;
                    maxBox.Left  = minBox.Right + 1;
                    this.Controls.Add(maxBox);

                    deltaBox       = new SmallTBox(this, parent.M.SetDelta, parent.M.GetDeltaString);
                    deltaBox.Width = (Width - maxBox.Right) - 5;
                    deltaBox.Left  = Width - deltaBox.Width;
                    this.Controls.Add(deltaBox);
                }
 protected virtual void OnEnable()
 {
     controllable = (controllable == null ? GetComponent <VRTK_BaseControllable>() : controllable);
     controllable.ValueChanged    += ValueChanged;
     controllable.MaxLimitReached += MaxLimitReached;
     controllable.MinLimitReached += MinLimitReached;
     ctrl = GetComponent <ButtonCtrl>();
 }
예제 #8
0
    static void _BuildMenuButtons(EditorControl parent)
    {
        Rect btnRect = new Rect(0, 0, 60, 20);
        //Rect undoRect = new Rect(0, 0, 120, 20);
        //Rect colorCtrlRect = new Rect(0, 0, 200, 20);
        //Rect returnBtnRect = new Rect(0, 0, 120, 20);

        ButtonCtrl newBtn = new ButtonCtrl();

        newBtn.Name    = s_newBtnName;
        newBtn.Caption = "新建";
        newBtn.Size    = btnRect;
        newBtn.onClick = OnNewBtnClick;
        parent.Add(newBtn);

        ButtonCtrl saveBtn = new ButtonCtrl();

        saveBtn.Name    = s_saveBtnName;
        saveBtn.Caption = "保存";
        saveBtn.Size    = btnRect;
        saveBtn.onClick = OnSaveBtnClick;
        parent.Add(saveBtn);


        ButtonCtrl undoBtn = new ButtonCtrl();

        undoBtn.Name    = s_undoBtnName;
        undoBtn.Caption = "撤消";
        undoBtn.Size    = btnRect;
        undoBtn.onClick = OnUndoBtnClick;
        parent.Add(undoBtn);

        ButtonCtrl redoBtn = new ButtonCtrl();

        redoBtn.Name    = s_redoBtnName;
        redoBtn.Caption = "重做";
        redoBtn.Size    = btnRect;
        redoBtn.onClick = OnRedoBtnClick;
        parent.Add(redoBtn);

        TextBoxCtrl openFileTextBox = new TextBoxCtrl();

        openFileTextBox.Name    = s_openFileTextBoxName;
        openFileTextBox.Caption = "当前打开文件";
        openFileTextBox.Enable  = false;
        openFileTextBox.Text    = "空";
        openFileTextBox.Size    = new Rect(0, 0, 150, 20);
        parent.Add(openFileTextBox);

        ObjectFieldCtrl previewModelCtrl = new ObjectFieldCtrl();

        previewModelCtrl.Name               = s_previewModelCtrlName;
        previewModelCtrl.Caption            = "预览模型";
        previewModelCtrl.ObjectType         = typeof(GameObject);
        previewModelCtrl.IsAlowSceneObjects = false;
        previewModelCtrl.onValueChange      = OnPreviewModelValueChanged;
        parent.Add(previewModelCtrl);
    }
예제 #9
0
 private void Awake()
 {
     this.Text_Get        = base.transform.Find("Button/fg/Text_Get").GetComponent <Text>();
     this.Text_FreeGet    = base.transform.Find("Button/fg/Text_FreeGet").GetComponent <Text>();
     this.Text_FreeTime   = base.transform.Find("Button/Text_FreeTime").GetComponent <Text>();
     this.mGoldCtrl       = base.transform.Find("Button/fg/ResourceText").GetComponent <GoldTextCtrl>();
     this.mButton         = base.transform.Find("Button").GetComponent <ButtonCtrl>();
     this.mButton.onClick = new Action(this.OnClickButton);
 }
예제 #10
0
    void Awake()
    {
        if (button != null)
        {
            buttonCtrl = button.GetComponent <ButtonCtrl>();
        }

        targetRenderer = this.GetComponent <Renderer>();
    }
예제 #11
0
 private void Awake()
 {
     this.Obj_RedNode        = base.transform.Find("Button_Box/fg/Image_RedNode").gameObject;
     this.BoxAni             = base.GetComponent <Animator>();
     this.Button_Box         = base.transform.Find("Button_Box").GetComponent <ButtonCtrl>();
     this.Button_Box.onClick = delegate {
         this.BoxAniPlay(false);
         WindowUI.ShowWindow(WindowID.WindowID_BoxOpen);
     };
 }
 public PageData(int page, Transform self, UIBase ctrl)
 {
     this.Page     = page;
     this.self     = self;
     this.PageCtrl = ctrl;
     this.PageCtrl.InitBefore();
     this.animation  = self.Find("child").GetComponent <Animation>();
     this.buttonctrl = self.Find("child/child/Button").GetComponent <ButtonCtrl>();
     this.buttonrect = this.buttonctrl.transform as RectTransform;
     this.redctrl    = self.GetComponentInChildren <RedNodeCtrl>();
 }
예제 #13
0
 protected override void OnInit()
 {
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             ButtonCtrl            ctrl  = this.skillbutton[i];
             ChooseSkillButtonCtrl ctrl2 = this.chooseskillbutton[i];
             ctrl.onClick = new Action(ctrl2.OnClick);
         }
     }
 }
예제 #14
0
    public static void InitControls(EditorRoot editorRoot)
    {
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);

        {
            s_root.onDestroy = OnDestroy;
            s_root.onEnable  = OnEnable;
        }

        HSpliterCtrl hspliter = new HSpliterCtrl();

        hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        s_root.RootCtrl = hspliter;

        //上方树状视图
        VBoxCtrl vb0 = new VBoxCtrl();

        hspliter.Add(vb0);

        //下方工具条
        HBoxCtrl hb0 = new HBoxCtrl();

        hspliter.Add(hb0);


        TreeViewCtrl treeView = new TreeViewCtrl();

        treeView.Name          = "_MainTreeView";
        treeView.onValueChange = OnTreeViewNodeToggle;
        vb0.Add(treeView);

        Rect       btnRect = new Rect(0, 0, 60, 20);
        ButtonCtrl okBtn   = new ButtonCtrl();

        okBtn.Caption = "确定";
        okBtn.Name    = "_OkButton";
        okBtn.Size    = btnRect;
        okBtn.onClick = OnOkButtonClick;

        ButtonCtrl cancelBtn = new ButtonCtrl();

        cancelBtn.Caption = "取消";
        cancelBtn.Name    = "_CancelButton";
        cancelBtn.Size    = btnRect;
        cancelBtn.onClick = OnCancelButtonClick;


        hb0.Add(okBtn);
        hb0.Add(cancelBtn);
    }
예제 #15
0
파일: vSlider.cs 프로젝트: Donaim/vutils
                public ManiZone(ButtonCtrl p)
                {
                    parent = p;
                    rate   = parent.M.GetRate();

                    CheckForIllegalCrossThreadCalls = false;
                    BackColor      = Color.Blue;
                    DoubleBuffered = false;
                    Size           = parent.BottomSize;
                    Location       = new Point(0, parent.Height - this.Height);

                    MouseDown += ManiZone_MouseDown;
                    MouseUp   += ManiZone_MouseUp;
                    MouseMove += ManiZone_MouseMove;

                    bG = BufferedGraphicsManager.Current.Allocate(CreateGraphics(), ClientRectangle);
                    bG.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                    refreshLoop();
                }
예제 #16
0
    private void Awake()
    {
        this.index          = int.Parse(base.name.Substring(base.name.Length - 1, 1));
        this.buttonObj      = Object.Instantiate <GameObject>(ResourceManager.Load <GameObject>("UIPanel/CharUI/EquipBG"));
        this.button         = this.buttonObj.GetComponent <ButtonCtrl>();
        this.button.onClick = new Action(this.OnClick);
        this.buttonText     = this.button.GetComponent <Text>();
        Transform child = this.buttonObj.transform;

        child.SetParentNormal(base.transform);
        this.addani      = child.Find("fg/Image_Add").GetComponent <Animation>();
        this.Image_BG    = child.Find("fg/Image_BG").GetComponent <Image>();
        this.equipparent = this.addani.transform.Find("equipparent").gameObject;
        string str = string.Empty;

        switch (this.index)
        {
        case 0:
            str = "EquipUI_BG_Weapon";
            break;

        case 1:
            str = "EquipUI_BG_Cloth";
            break;

        case 2:
        case 3:
            str = "EquipUI_BG_Ornament";
            break;

        case 4:
        case 5:
            str = "EquipUI_BG_Pet";
            break;
        }
        this.Image_BG.set_sprite(SpriteManager.GetCharUI(str));
        this.addparent = this.addani.transform.Find("addparent").gameObject;
        this.Text_Add  = this.addparent.transform.Find("Image_Shadow/Text_Add").GetComponent <Text>();
        this.equipdata = null;
        this.UpdateBGShow();
        this.ShowAdd(false);
    }
예제 #17
0
 private void Start()
 {
     button = GameObject.Find("ChildButtonCtrl").GetComponent <ChildButton>();
 }
    //这个方法就是利用EditorManager回调回来的一个EditorRoot实例;
    //构建了一个树形结构;
    public static void InitControls(EditorRoot editorRoot)
    {
        //将之前实例化的那个EditorWindow赋值给s_root
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);

        {//对编辑器全局消息响应;
            EditorApplication.projectWindowItemOnGUI += OnProjectWindowItem;
            EditorApplication.projectWindowChanged   += OnProjectWindowChanged;
        }

        {//协程回调
            s_root.onCoroutineMessage      = OnCoroutineMessage;
            s_root.onCoroutineTaskFinished = OnCoroutineTaskFinished;
            s_root.onDestroy = OnDestroy;
            s_root.onEnable  = OnEnable;
        }

        {//注册数据库变化回调
            ResourceManageToolModel.GetInstance().onResourceDBUpdate      = OnAssetDatabaseUpdate;
            ResourceManageToolModel.GetInstance().onResrouceDBStateChange = OnAssetDatabaseStateChange;
        }

        HSpliterCtrl hspliter = new HSpliterCtrl();

        s_root.RootCtrl           = hspliter;
        hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);

        //用来放置上方菜单
        HBoxCtrl     hb0      = new HBoxCtrl();
        VSpliterCtrl vspliter = new VSpliterCtrl();

        vspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        vspliter.Dragable         = true;

        hspliter.Add(hb0);
        hspliter.Add(vspliter);

        //用来存放 资源列表、无引用资源列表
        VBoxCtrl vb0 = new VBoxCtrl();
        //用来存放 资源依赖项、反向引用
        VBoxCtrl vb1 = new VBoxCtrl();

        vspliter.Add(vb0);
        vspliter.Add(vb1);

        //左侧TabView
        TabViewCtrl leftTabView = new TabViewCtrl();
        //右侧TabView
        TabViewCtrl rightTabView = new TabViewCtrl();

        vb0.Add(leftTabView);
        vb1.Add(rightTabView);

        //资源列表
        TreeViewCtrl resTreeList = new TreeViewCtrl();

        resTreeList.Caption        = "资源列表";
        resTreeList.Name           = "_ResTreeList";
        resTreeList.onItemSelected = OnResourcesTreeViewSelectChanged;

        //无引用资源列表
        ListViewCtrl unUsedList = new ListViewCtrl();

        unUsedList.Caption        = "无引用资源";
        unUsedList.Name           = "_UnUsedResList";
        unUsedList.onItemSelected = OnUnUsedResourcesListViewSelectChanged;

        leftTabView.Add(resTreeList);
        leftTabView.Add(unUsedList);

        //资源依赖项
        TreeViewCtrl resRefTreeView = new TreeViewCtrl();

        resRefTreeView.Caption = "资源依赖项";
        resRefTreeView.Name    = "_ResRefTreeView";


        //反向引用
        TreeViewCtrl resReverseRefTreeView = new TreeViewCtrl();

        resReverseRefTreeView.Caption = "反向引用";
        resReverseRefTreeView.Name    = "_ResReverseRefTreeView";

        rightTabView.Add(resRefTreeView);
        rightTabView.Add(resReverseRefTreeView);


        Rect       btnRect   = new Rect(0, 0, 120, 20);
        ButtonCtrl searchBtn = new ButtonCtrl();

        searchBtn.Name     = "_SearchAllResources";
        searchBtn.Caption  = "扫描资源!";
        searchBtn.Size     = btnRect;
        searchBtn.onClick += OnSearchAllAssets;
        searchBtn.BtnColor = Color.green;
        searchBtn.Visiable = true;

        Rect comboBoxRect = new Rect(0, 0, 100, 20);
        ComboBoxCtrl <int> assetTypeCombo = new ComboBoxCtrl <int>(0);

        assetTypeCombo.Size          = comboBoxRect;
        assetTypeCombo.Name          = "_AssetTypeCombo";
        assetTypeCombo.onValueChange = OnFilterComboSelectChanged;

        List <IAssetFilter> assetFilters = ResourceManageToolModel.GetInstance().AssetFilterList;

        foreach (var filter in assetFilters)
        {
            AssetTypeFilter f = filter as AssetTypeFilter;
            assetTypeCombo.AddItem(new ComboItem(f.DisplayTypeName, f.TypeIndex));
        }

        assetTypeCombo.CurrValue = 0;

        TextBoxCtrl searchTextBox = new TextBoxCtrl();

        searchTextBox.Size          = comboBoxRect;
        searchTextBox.Icon          = UnityInternalIconCache.GetInstance().GetCacheIcon("d_ViewToolZoom");
        searchTextBox.Name          = "_SearchBox";
        searchTextBox.Caption       = "搜索";
        searchTextBox.Visiable      = true;
        searchTextBox.onValueChange = OnSearchTextBoxChange;

        ButtonCtrl helpBtn = new ButtonCtrl();

        helpBtn.Name     = "_HelpButton";
        helpBtn.Caption  = "帮助文档";
        helpBtn.onClick  = OnHelp;
        helpBtn.Size     = btnRect;
        helpBtn.Visiable = true;

        LabelCtrl stateLabel = new LabelCtrl();

        stateLabel.Name             = "_StateLabel";
        stateLabel.textColor        = Color.red;
        stateLabel.Caption          = "数据库没有更新,无法查看无用资源列表与反向引用!";
        stateLabel.layoutConstraint = LayoutConstraint.GetExtensibleViewConstraint();

        hb0.Add(searchBtn);
        hb0.Add(assetTypeCombo);
        hb0.Add(searchTextBox);
        hb0.Add(helpBtn);
        hb0.Add(stateLabel);
    }
예제 #19
0
    public GameObject CreatePlayer(Vector2 StartPos, int LevelNum)
    {
        GameObject SceneManager = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefab/" + "SceneManager"));

        SceneManager.transform.position = new Vector3(StartPos.x, StartPos.y, SceneManager.transform.position.z);

        m_SceneMover = SceneManager.GetComponent <ScenePathMover> ();

        m_SceneMover.LoadMiddleScene(LevelNum);

        m_ShipGroup = SceneManager.transform.Find("ShipGroup").gameObject;

        m_PlayerCtrl = m_ShipGroup.GetComponent <PlayerCtrl>();

        m_Player = SceneManager.transform.Find("ShipGroup/TriangleShipObj").gameObject;

        TriangleShip ship = m_Player.GetComponent <TriangleShip> ();

        ship.StartPosObject = SceneManager.transform.Find("ShipGroup/StartPos").gameObject;

        ship.StartPosObject.SetActive(false);

        ship.BornPosObject = SceneManager.transform.Find("ShipGroup/BornPos").gameObject;

        ship.BornPosObject.SetActive(false);

        ship.CompletePosObject = SceneManager.transform.Find("CompletePos").gameObject;

        ship.CompletePosObject.SetActive(false);

        GameCamera = SceneManager.transform.Find("MainCamera").gameObject.GetComponent <LogicCamera>();
        GameCamera.SetShip(ship);
        GameCamera.SetSceneMgrObj(SceneManager);

        m_EnergyBar = SceneManager.transform.Find("Canvas/EnergyBar").gameObject.GetComponent <EnergyBar>();

        m_LifeBar = SceneManager.transform.Find("Canvas/LifeBar").gameObject.GetComponent <LifeBar>();

        for (int i = 0; i < ship.GetCurShipLifeTimes(); ++i)
        {
            m_LifeBar.AddLife();
        }

        m_ThanksBoard = SceneManager.transform.Find("Canvas/ThanksPlayer").gameObject.GetComponent <ThanksBoard>();
        m_ThanksBoard.gameObject.SetActive(false);

        m_BtnCtrl = SceneManager.transform.Find("Canvas/BtnCtrl").gameObject.GetComponent <ButtonCtrl>();
        m_BtnCtrl.SetMainBody(ship);

#if UNITY_STANDALONE
        m_BtnCtrl.gameObject.SetActive(false);
#else
#endif

        MusicManager.GetInstance().SFXCtrl = SceneManager.transform.Find("SFXCtrl").gameObject.GetComponent <SoundController>();

        MusicManager.GetInstance().BGMCtrl = SceneManager.transform.Find("BGMCtrl").gameObject.GetComponent <BGMController>();

        m_GameOverShow = SceneManager.transform.Find("Canvas/GameOver").gameObject;
        m_GameOverShow.SetActive(false);

        return(m_Player);
    }
예제 #20
0
    public static void InitControls(EditorRoot editorRoot)
    {//初始化窗口
        if (editorRoot == null)
        {
            //提示程序错误Message
            EditorUtility.DisplayDialog("运行错误",
                                        "窗口初始化失败",
                                        "确认");
            return;
        }

        s_root = editorRoot;
        //s_root.position = new Rect(100f, 100f, 1280, 768f);

        {
            s_root.onEnable  = OnEnable;
            s_root.onDisable = OnDisable;
        }

        #region 创建布置窗口元素

        #region 第一级分割
        Rect btnRect   = new Rect(0, 0, 80, 20);
        Rect labelRect = new Rect(0, 0, 80, 5);
        Rect hboxRect  = new Rect(0, 0, 300, 5);

        HSpliterCtrl hs1 = new HSpliterCtrl();
        hs1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);
        HSpliterCtrl hs2 = new HSpliterCtrl();
        hs2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        HBoxCtrl hb1 = new HBoxCtrl();      //布置上方菜单条
        HBoxCtrl hb2 = new HBoxCtrl();      //布置主窗口
        HBoxCtrl hb3 = new HBoxCtrl();      //布置下方状态栏
        #endregion

        #region 第二级分割
        VSpliterCtrl vs2_1 = new VSpliterCtrl();
        vs2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        vs2_1.Dragable         = true;
        VSpliterCtrl vs2_2 = new VSpliterCtrl();
        vs2_2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f, true);
        vs2_2.Dragable         = true;

        VBoxCtrl vb2_1 = new VBoxCtrl();               //布置工程目录/小图列表
        VBoxCtrl vb2_2 = new VBoxCtrl();               //布置预览窗口
        VBoxCtrl vb2_3 = new VBoxCtrl();               //布置Inspector窗口
        #endregion

        #region 第三级分割
        HSpliterCtrl hs2_1_1 = new HSpliterCtrl();
        hs2_1_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(260f, true);

        VBoxCtrl vb2_1_1 = new VBoxCtrl();                    //布置小图列表
        VBoxCtrl vb2_1_2 = new VBoxCtrl();                    //布置工程目录
        #endregion

        #region  第四级分割
        HSpliterCtrl hs2_1_2_1 = new HSpliterCtrl();
        hs2_1_2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(240, true);

        VBoxCtrl vb2_1_2_1 = new VBoxCtrl();                    //布置小图列表
        VBoxCtrl vb2_1_2_2 = new VBoxCtrl();                    //布置工程目录
        #endregion
        #endregion

        #region 布置窗口(由高至低布置)

        #region 第四级分割

        #region Project View
        HBoxCtrl projectBtnBox = new HBoxCtrl();
        projectBtnBox.Size = hboxRect;

        LabelCtrl procLabel = new LabelCtrl();
        procLabel.Size    = labelRect;
        procLabel.Caption = "Project View";

        ButtonCtrl newProjBtn = new ButtonCtrl();
        newProjBtn.Caption = "新建工程";
        newProjBtn.Name    = "_NewProjBtn";
        newProjBtn.Size    = btnRect;
        newProjBtn.onClick = OnNewProjBtn;

        ButtonCtrl openProjBtn = new ButtonCtrl();
        openProjBtn.Caption = "打开工程";
        openProjBtn.Name    = "_OpenProjBtn";
        openProjBtn.Size    = btnRect;
        openProjBtn.onClick = OnOpenProjBtn;

        ButtonCtrl saveProjBtn = new ButtonCtrl();
        saveProjBtn.Caption = "保存工程";
        saveProjBtn.Name    = "_SaveProjBtn";
        saveProjBtn.Size    = btnRect;
        saveProjBtn.onClick = OnSaveProjBtn;
        projectBtnBox.Add(newProjBtn);
        projectBtnBox.Add(saveProjBtn);
        projectBtnBox.Add(openProjBtn);

        // vb2_1_2_1.Add(procLabel);
        vb2_1_2_1.Add(projectBtnBox);
        #endregion

        m_projTreeView                = new ListViewCtrl(); //工程目录
        m_projTreeView.Caption        = "Project";
        m_projTreeView.Name           = "Project";
        m_projTreeView.onItemSelected = OnSelectProjectListItem;
        m_projTreeView.IsTextureView  = false;


        vb2_1_2_2.Add(m_projTreeView);

        hs2_1_2_1.Add(vb2_1_2_1);
        hs2_1_2_1.Add(vb2_1_2_2);
        #endregion

        #region 第三级分割
        m_spriteListView = new ListViewCtrl();        //小图列表
        m_spriteListView.IsTextureView = false;
        m_spriteListView.Caption       = "小图";
        m_spriteListView.Name          = "spriteTreeView";

        m_spriteListView.onItemSelected     = OnSelectListItem;
        m_spriteListView.onItemCtrlSelected = OnSelectListItem;
        m_spriteListView.onItemSelectedR    = OnSelectListItemR;
        m_spriteListView.onItemSelectedRU   = OnSelectListItemRU;
        vb2_1_1.Add(m_spriteListView);
        vb2_1_2.Add(hs2_1_2_1);

        hs2_1_1.Add(vb2_1_1);
        hs2_1_1.Add(vb2_1_2);
        #endregion

        #region 第二级分割
        m_preview          = new MainViewCtrl();     //预览窗口
        m_preview.Name     = "_Preview";
        m_preview.bkColor  = Color.grey;
        m_preview.Is2DView = true;

        m_inspector             = new InspectorViewCtrl(); //属性窗口
        m_inspector.Name        = "_Inspector";
        m_inspector.onInspector = null;

        vb2_1.Add(hs2_1_1);
        vb2_2.Add(m_preview);
        vb2_3.Add(m_inspector);

        vs2_1.Add(vb2_1);
        vs2_1.Add(vs2_2);

        vs2_2.Add(m_preview);
        vs2_2.Add(vb2_3);
        #endregion

        #region 第一级分割
        #region  方菜单条
        ButtonCtrl addImageBtn = new ButtonCtrl();
        addImageBtn.Caption = "添加小图";
        addImageBtn.Name    = "_AddImageBtn";
        addImageBtn.Size    = btnRect;
        addImageBtn.onClick = OnAddImageBtn;

        ButtonCtrl previewBtn = new ButtonCtrl();
        previewBtn.Caption = "生成预览";
        previewBtn.Name    = "_PreviewBtn";
        previewBtn.Size    = btnRect;
        previewBtn.onClick = OnPreviewBtn;

        ButtonCtrl makeAtlasBtn = new ButtonCtrl();
        makeAtlasBtn.Caption = "生成图集";
        makeAtlasBtn.Name    = "_MakeAtlasBtn";
        makeAtlasBtn.Size    = btnRect;
        makeAtlasBtn.onClick = OnMakeAtlasBtn;

        ButtonCtrl configImageBaseBtn = new ButtonCtrl();
        configImageBaseBtn.Caption = "配置图库路径";
        configImageBaseBtn.Name    = "_ConfigImageBaseBtn";
        configImageBaseBtn.Size    = btnRect;
        configImageBaseBtn.onClick = OnConfigImageBaseBtn;

        ButtonCtrl helpBtn = new ButtonCtrl();
        helpBtn.Caption  = "帮助";
        helpBtn.Size     = btnRect;
        helpBtn.onClick += OnHelp;

        hb1.Add(addImageBtn);
        hb1.Add(previewBtn);
        hb1.Add(makeAtlasBtn);
        hb1.Add(configImageBaseBtn);
        hb1.Add(helpBtn);
        #endregion

        hb2.Add(vs2_1);

        hs1.Add(hb1);
        hs1.Add(hs2);

        hs2.Add(hb2);
        hs2.Add(hb3);
        #endregion

        #endregion

        //设置窗口根控件
        s_root.RootCtrl = hs1;

        //注册UIAtlasEditorModel回调函数
        UIAtlasEditorModel.GetInstance().onNewProject          = OnNewProject;
        UIAtlasEditorModel.GetInstance().onSpriteImageLoad     = OnSpriteImageLoad;
        UIAtlasEditorModel.GetInstance().onClearCurrentProject = OnClearCurrentProject;

        UIAtlasEditorModel.GetInstance().onAddSpriteImageCommand    = OnAddSpriteImageCommand;
        UIAtlasEditorModel.GetInstance().onDeleteSpriteImageCommand = OnDeleteSpriteImageCommand;
        UIAtlasEditorModel.GetInstance().onMakeAtlasCommand         = OnMakeAtlasCommand;
        UIAtlasEditorModel.GetInstance().onSpriteZoomChangedCommand = OnSpriteImageZoomChangedCommand;

        //注册编辑器窗口OnGui回调函数
        s_root.onGUI        = OnEditorGUI;
        m_Counter           = new GameObject();
        m_Counter.name      = "AtlasCmdCounter";
        m_Counter.hideFlags = HideFlags.HideAndDontSave;
        m_Counter.AddComponent <UIAtlasCommandCounter>();
        m_CommandCounter = m_Counter.GetComponent <UIAtlasCommandCounter>();
    }
예제 #21
0
    public static void InitControls(EditorRoot editorRoot)
    {
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);
        s_root.onDestroy = OnDestroy;
        s_root.onEnable  = OnEnable;

        Rect btnRect      = new Rect(0, 0, 80, 20);
        Rect comboBoxRect = new Rect(0, 0, 100, 20);

        //Modify by liteng for 发布工具改善Start
        #region 创建布置窗口元素
        #region 第一级
        HSpliterCtrl hs1 = new HSpliterCtrl();
        hs1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);
        HSpliterCtrl hs2 = new HSpliterCtrl();
        hs2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        HBoxCtrl hb1 = new HBoxCtrl();      //布置上方菜单条
        HBoxCtrl hb2 = new HBoxCtrl();      //布置主窗口
        HBoxCtrl hb3 = new HBoxCtrl();      //布置下方状态栏
        #endregion

        #region 第二级
        VSpliterCtrl vs2_1 = new VSpliterCtrl();
        vs2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        vs2_1.Dragable         = true;

        VBoxCtrl vb2_1 = new VBoxCtrl();               //资源视图
        VBoxCtrl vb2_2 = new VBoxCtrl();               //发布信息视图
        #endregion
        #endregion

        #region 布置窗口(由高至低布置)
        #region 第二级
        TreeViewCtrl m_treeView = new TreeViewCtrl();   //资源列表
        m_treeView.Name          = "_MainTreeView";
        m_treeView.onValueChange = OnTreeViewNodeToggle;

        InspectorViewCtrl m_inspector = new InspectorViewCtrl();  //发布信息视图
        m_inspector.Name        = "_Inspector";
        m_inspector.onInspector = OnInspector;

        vb2_1.Add(m_treeView);
        vb2_2.Add(m_inspector);
        vs2_1.Add(vb2_1);
        vs2_1.Add(vb2_2);

        hb2.Add(vs2_1);
        #endregion

        #region 第一级
        //[导出]按钮
        ButtonCtrl exportBtn = new ButtonCtrl();
        exportBtn.Caption = "导出";
        exportBtn.Name    = "_ExportButton";
        exportBtn.Size    = btnRect;
        exportBtn.onClick = OnExportBtnClick;

        //[发布]按钮
        //ButtonCtrl publishBtn = new ButtonCtrl();
        //publishBtn.Caption = "发布";
        //publishBtn.Name = "_PublishButton";
        //publishBtn.Size = btnRect;
        //publishBtn.onClick = OnPublishBtnClick;


        //[配置AB路径]按钮
        //ButtonCtrl configPublishBtn = new ButtonCtrl();
        //configPublishBtn.Caption = "配置AB路径";
        //configPublishBtn.Name = "_ConfigPublishButton";
        //configPublishBtn.Size = btnRect;
        //configPublishBtn.onClick = OnConfigPublishPathBtnClick;

        //版本下拉菜单
        ComboBoxCtrl <int> debugCombo = new ComboBoxCtrl <int>(0);
        debugCombo.Size          = comboBoxRect;
        debugCombo.Name          = "_DebugCombo";
        debugCombo.onValueChange = OnDebugComboSelect;
        debugCombo.AddItem(new ComboItem("Debug", 0));
        debugCombo.AddItem(new ComboItem("Release", 1));

        hb1.Add(exportBtn);
        //hb1.Add(publishBtn);
        //hb1.Add(configPublishBtn);
        hb1.Add(debugCombo);

        hs1.Add(hb1);
        hs1.Add(hs2);
        hs2.Add(hb2);
        hs2.Add(hb3);
        #endregion


        #endregion
        s_root.RootCtrl = hs1;

        UpdateDebugCombobox();
        PackageExportToolModel.GetInstance().onExportComplete = OnExportComplete;
        //Modify by liteng for 发布工具改善 end

        #region 原有代码
        //HSpliterCtrl hspliter = new HSpliterCtrl();
        //hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        //上方树状视图
        //VBoxCtrl vb0 = new VBoxCtrl();
        //hspliter.Add(vb0);

        ////下方工具条
        //HBoxCtrl hb0 = new HBoxCtrl();
        //hspliter.Add(hb0);

        //TreeViewCtrl treeView = new TreeViewCtrl();
        //treeView.Name = "_MainTreeView";
        //vb0.Add(treeView);

        //TextBoxCtrl tbVersion = new TextBoxCtrl();
        //tbVersion.Size = new Rect(0, 0, 30, 20);
        //tbVersion.Name = "_VersionBox";
        //tbVersion.Caption = "版本号";
        //tbVersion.Enable = true;
        //tbVersion.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50);

        //TextBoxCtrl tbFileName = new TextBoxCtrl();
        //tbFileName.Size = new Rect(0, 0, 60, 20);
        //tbFileName.Name = "_SaveFileName";
        //tbFileName.Caption = "输出文件";
        //tbFileName.Enable = true;
        //tbFileName.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50);

        //Rect btnRect = new Rect(0, 0, 60, 20);

        //ButtonCtrl ChooseFileBtn = new ButtonCtrl();
        //ChooseFileBtn.Caption = "选择";
        //ChooseFileBtn.Name = "_ChooseFileName";
        //ChooseFileBtn.Size = btnRect;
        //ChooseFileBtn.onClick = OnChooseFileNameButtonClick;

        //ButtonCtrl okBtn = new ButtonCtrl();
        //okBtn.Caption = "确定";
        //okBtn.Name = "_OkButton";
        //okBtn.Size = btnRect;
        //okBtn.onClick = OnOkButtonClick;

        //ButtonCtrl cancelBtn = new ButtonCtrl();
        //cancelBtn.Caption = "取消";
        //cancelBtn.Name = "_CancelButton";
        //cancelBtn.Size = btnRect;
        //cancelBtn.onClick = OnCancelButtonClick;

        //hb0.Add(tbVersion);
        //hb0.Add(tbFileName);
        //hb0.Add(ChooseFileBtn);
        //hb0.Add(okBtn);
        //hb0.Add(cancelBtn);
        #endregion
    }
예제 #22
0
    public static void InitControls(EditorRoot root)
    {
        /*将编辑器分为上下两个区域*/
        HSpliterCtrl Upanddown = new HSpliterCtrl();

        root.RootCtrl = Upanddown;
        Upanddown.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);

        #region 编辑器事件回调
        /*编辑器初始化事件*/
        root.onEnable += EditorWindowOnEnable;
        /*编辑器关闭事件*/
        root.onDestroy += EditorWindowOnDestroy;
        #endregion

        #region 编辑器的上边
        /*存放上方资源的容器*/
        HBoxCtrl upspliter = new HBoxCtrl();
        Upanddown.Add(upspliter);

        /*扫描资源按钮*/
        Rect       SearchBtnRect = new Rect(0, 0, 160, 20);
        ButtonCtrl SearchBtn     = new ButtonCtrl();
        SearchBtn.onClick  = SearchBtnClickEvent;
        SearchBtn.Size     = SearchBtnRect;
        SearchBtn.Visiable = true;
        SearchBtn.Caption  = "扫描资源";
        SearchBtn.Name     = "_SearchButton";

        /*下拉菜单,过滤器*/
        Rect ComboxFliterRect         = new Rect(0, 0, 120, 20);
        ComboBoxCtrl <int> TypeFliter = new ComboBoxCtrl <int>(0);
        TypeFliter.Size           = ComboxFliterRect;
        TypeFliter.Name           = "_TypeFliter";
        TypeFliter.onValueChange += FilterOnchange;

        for (int i = 0; i <= 3; i++)
        {
            TypeFliter.AddItem(new ComboItem("选项0", 0));
            TypeFliter.AddItem(new ComboItem("选项1", 1));
            TypeFliter.AddItem(new ComboItem("选项2", 2));
            TypeFliter.AddItem(new ComboItem("选项3", 3));
        }

        TypeFliter.CurrValue = 0;

        /*数据库状态显示*/
        LabelCtrl StateLabel = new LabelCtrl();
        StateLabel.Caption = "数据库没有更新,请点击刷新资源数据库";
        StateLabel.Name    = "_StateLabel";

        /*将控件放入上方资源*/
        upspliter.Add(SearchBtn);
        upspliter.Add(TypeFliter);
        upspliter.Add(StateLabel);
        #endregion

        #region 编辑器的下边
        /*将下放资源分为左右两个区域*/
        VSpliterCtrl downspliter = new VSpliterCtrl();
        Upanddown.Add(downspliter);
        downspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        downspliter.Dragable         = true;

        /*存放左侧资源列表和无引用资源的容器*/
        VBoxCtrl LeftAssetContainer = new VBoxCtrl();
        downspliter.Add(LeftAssetContainer);

        /*左侧两枚选项卡*/
        TabViewCtrl leftTabView = new TabViewCtrl();
        LeftAssetContainer.Add(leftTabView);

        /*资源列表*/
        TreeViewCtrl AssetsTreeView = new TreeViewCtrl();
        AssetsTreeView.Caption = "资源列表";
        AssetsTreeView.Name    = "_AssetList";
        leftTabView.Add(AssetsTreeView);

        /*无用资源列表*/
        ListViewCtrl UseLessAssetsList = new ListViewCtrl();
        UseLessAssetsList.Caption = "无用资源";
        UseLessAssetsList.Name    = "_UseLessAssetsList";
        leftTabView.Add(UseLessAssetsList);

        /*存放正向反向资源依赖关系的容器*/
        VBoxCtrl RightAssetDependceContainer = new VBoxCtrl();
        downspliter.Add(RightAssetDependceContainer);

        /*右侧两枚选项卡*/
        TabViewCtrl rightTabView = new TabViewCtrl();
        RightAssetDependceContainer.Add(rightTabView);

        /*资源正向依赖关系列表*/
        ListViewCtrl DependcyAssetsList = new ListViewCtrl();
        DependcyAssetsList.Caption = "正向依赖关系";
        DependcyAssetsList.Name    = "_DependAssetsList";
        rightTabView.Add(DependcyAssetsList);

        /*资源反向依赖关系列表*/
        ListViewCtrl DedependcyAssetsList = new ListViewCtrl();
        DedependcyAssetsList.Caption = "反向依赖关系";
        DedependcyAssetsList.Name    = "_DedependcyAssetsList";
        rightTabView.Add(DedependcyAssetsList);
        #endregion
    }
예제 #23
0
    public static void InitControls(EditorRoot editorRoot)
    {
        SearchSpriteEditor searchSpriteEditor = editorRoot as SearchSpriteEditor;

        if (editorRoot == null)
        {
            //提示程序错误Message
            EditorUtility.DisplayDialog("运行错误",
                                        "窗口初始化失败",
                                        "确认");
            return;
        }

        m_EditorRoot = searchSpriteEditor;

        m_EditorRoot.position = new Rect(100f, 100f, m_RootWidth, 768f);


        #region 创建窗口布局元素
        Rect searchTextRect = new Rect(0, 0, 300, 20);

        #region 第一级分割
        HSpliterCtrl hs1 = new HSpliterCtrl();
        hs1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);

        HSpliterCtrl hs2 = new HSpliterCtrl();
        hs2.MinOffset        = 100f;
        hs2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);
        hs2.Dragable         = true;

        HBoxCtrl hb1 = new HBoxCtrl();      //搜索栏 HB
        HBoxCtrl hb2 = new HBoxCtrl();      //预览区 HB
        VBoxCtrl vb3 = new VBoxCtrl();      //结果List HB
        #endregion

        #region 第二级分割
        VSpliterCtrl vs2_1 = new VSpliterCtrl();
        vs2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(m_RootWidth / 2);
        vs2_1.Dragable         = true;

        VBoxCtrl vb2_1 = new VBoxCtrl();
        VBoxCtrl vb2_2 = new VBoxCtrl();
        #endregion

        #region 第三级分割
        HSpliterCtrl hs2_1_1 = new HSpliterCtrl();
        hs2_1_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(10f, true);

        HSpliterCtrl hs2_2_1 = new HSpliterCtrl();
        hs2_2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(10f, true);

        HBoxCtrl hb2_1_1 = new HBoxCtrl();
        HBoxCtrl hb2_1_2 = new HBoxCtrl();

        HBoxCtrl hb2_2_1 = new HBoxCtrl();
        HBoxCtrl hb2_2_2 = new HBoxCtrl();
        #endregion
        #endregion

        #region 布置窗口
        TextBoxCtrl searchTextBox = new TextBoxCtrl();
        searchTextBox.Size    = searchTextRect;
        searchTextBox.Icon    = UnityInternalIconCache.GetInstance().GetCacheIcon("d_ViewToolZoom");
        searchTextBox.Name    = m_SearchTextBoxName;
        searchTextBox.Caption = "搜索";

        ButtonCtrl vagueSearchBtn = new ButtonCtrl();
        vagueSearchBtn.Name    = m_VagueSearchBtnName;
        vagueSearchBtn.Caption = "模糊搜索";
        vagueSearchBtn.onClick = searchSpriteEditor.OnSearchBtn;

        ButtonCtrl searchBtn = new ButtonCtrl();
        searchBtn.Name    = m_SearchBtnName;
        searchBtn.Caption = "精确搜索";
        searchBtn.onClick = searchSpriteEditor.OnSearchBtn;

        ButtonCtrl setBtn = new ButtonCtrl();
        setBtn.Name    = m_SetBtnName;
        setBtn.Caption = "设置";
        setBtn.onClick = searchSpriteEditor.OnSetBtn;

        ButtonCtrl helpBtn = new ButtonCtrl();
        helpBtn.Name    = m_HelpBtnName;
        helpBtn.Caption = "帮助";
        helpBtn.onClick = searchSpriteEditor.OnHelpBtnClick;

        hb1.Add(searchTextBox);
        hb1.Add(vagueSearchBtn);
        hb1.Add(searchBtn);
        hb1.Add(setBtn);
        hb1.Add(helpBtn);

        MainViewCtrl spriteView = new MainViewCtrl();
        spriteView.Name     = m_SpriteViewName;
        spriteView.bkColor  = Color.gray;
        spriteView.Is2DView = true;

        LabelCtrl spriteInfoLabel = new LabelCtrl();
        spriteInfoLabel.Name    = m_SpriteInfoLabel;
        spriteInfoLabel.Caption = "";

        MainViewCtrl atlasView = new MainViewCtrl();
        atlasView.Name     = m_AtlasViewName;
        atlasView.bkColor  = Color.gray;
        atlasView.Is2DView = true;

        LabelCtrl atlasInfoLabel = new LabelCtrl();
        atlasInfoLabel.Name    = m_AtlasInfoLabel;
        atlasInfoLabel.Caption = "";

        hb2_1_1.Add(spriteView);
        hb2_1_2.Add(spriteInfoLabel);

        hb2_2_1.Add(atlasView);
        hb2_2_2.Add(atlasInfoLabel);

        hs2_1_1.Add(hb2_1_1);
        hs2_1_1.Add(hb2_1_2);

        hs2_2_1.Add(hb2_2_1);
        hs2_2_1.Add(hb2_2_2);

        vb2_1.Add(hs2_1_1);
        vb2_2.Add(hs2_2_1);

        vs2_1.Add(vb2_1);
        vs2_1.Add(vb2_2);

        hb2.Add(vs2_1);

        ListViewCtrl searchResultList = new ListViewCtrl();
        searchResultList.Name            = m_SearchResultListName;
        searchResultList.onItemSelected  = searchSpriteEditor.OnSelectListItem;
        searchResultList.onItemSelectedR = searchSpriteEditor.OnSelectListItem;

        SpaceCtrl spaceCtrl = new SpaceCtrl();
        spaceCtrl.CurrValue = 30f;

        vb3.Add(searchResultList);
        vb3.Add(spaceCtrl);

        hs1.Add(hb1);
        hs1.Add(hs2);

        hs2.Add(hb2);
        hs2.Add(vb3);

        m_EditorRoot.RootCtrl = hs1;
        #endregion

        m_EditorRoot.onGUI = searchSpriteEditor.OnEditorGUI;
    }