Beispiel #1
0
        internal GameOptionButton(GameObject parent, string goname)
        {
            string sceneName = SingletonMonoBehaviour <ManagementManager> .Instance.scenemanager.getNowSceneName();

            if (SceneList.getSceneName(SceneList.Type.MyRoom) == sceneName)
            {
                GameObject gop  = GameObject.Find(sceneName).transform.FindChild("UI Root/Camera/MasterProfilePanel").gameObject;
                GameObject orig = GameObject.Find(sceneName).transform.FindChild("UI Root/Camera/MasterProfilePanel/ChangeProfileDlg/BaseWindow/SubmitBtn").gameObject;
                GameObject go   = NGUIUtil.SetCloneChild(parent, orig, goname);
                this.goButton = go;
                this.uiButton = go.GetComponentInChildren <UIButton>();
                this.uiButton.onClick.Clear();
            }
        }
Beispiel #2
0
        void AddHeader()
        {
            GameObject goTitleImg = NGUIUtil.SetCloneChild(gameObject, scrollView.transform.FindChild("SetVolume/TitleImg").gameObject, "TitleImg");

            NGUIUtil.DestroyChild(goTitleImg, "TitleTxt");
            UILabel label = NGUITools.AddChild <UILabel>(goTitleImg);

            label.name                    = "Title";
            label.trueTypeFont            = font;
            label.fontSize                = 30;
            label.text                    = "额外功能";
            label.width                   = 400;
            label.overflowMethod          = UILabel.Overflow.ShrinkContent;
            label.transform.localPosition = new Vector3(0f, 20f, 0f);
        }
        internal GameOptionToggle(GameObject parent, string prefKey, bool defaultValue = false, string goname = null)
        {
            this.DefaultValue = defaultValue;
            if (goname == null)
            {
                goname = prefKey;
            }
            key = prefKey;
            string sceneName = SingletonMonoBehaviour <ManagementManager> .Instance.scenemanager.getNowSceneName();

            if (SceneList.getSceneName(SceneList.Type.MyRoom) == sceneName)
            {
                GameObject gop  = GameObject.Find(sceneName).transform.FindChild("UI Root/Camera/GameOptionPanel").gameObject;
                GameObject orig = gop.transform.FindChild("Option/Scroll View/SetNotice/ApRecovered/NoticeAp").gameObject;
                GameObject go   = NGUIUtil.SetCloneChild(parent, orig, goname);
                this.goButton = go;
                this.uiButton = go.GetComponentInChildren <UIButton>();
                EventDelegate.Set(this.uiButton.onClick, new EventDelegate.Callback(this.OnChangeBtn));
                initButtonState();
            }
        }
        // 在GameOptions后加上自定义UI
        // SetGameOptionComponent::ShowGameOption
        public static void AddAlterOption()
        {
            GameObject gameOptionPanel = GameObject.Find("GameOptionPanel");

            if (!gameOptionPanel)
            {
                FGOAlterLog.print("错误!未能找到GameOptionPanel");
                return;
            }
            try
            {
                GameObject scrollView = gameOptionPanel.transform.FindChild("Option/Scroll View").gameObject;
                if (!scrollView)
                {
                    FGOAlterLog.print("错误!未能找到Scroll View");
                    return;
                }
                string     componetName = "AlterOption";
                GameObject ac           = NGUIUtil.FindChild(scrollView, componetName);
                if (!ac)
                {
                    ac = new GameObject(componetName);
                    NGUIUtil.SetChild(scrollView, ac);
                    AlterOptionComponet child = ac.AddComponent <AlterOptionComponet>();
                    child.gameOptionPanel      = gameOptionPanel;
                    child.scrollView           = scrollView;
                    child.font                 = gameOptionPanel.GetComponentsInChildren <UILabel>()[0].trueTypeFont;
                    ac.transform.localPosition = new Vector3(0f, -1000f, 0);
                    ac.AddComponent <UIDragScrollView>().scrollView = scrollView.GetComponent <UIScrollView>();
                }
            }
            catch (Exception e)
            {
                FGOAlterLog.print(e.ToString());
            }
        }