internal GameOptionSlider(GameObject parent, string key, float defaultValue = 0, EventDelegate eventDelegate = null, string goname = null) { this.key = key; this.defaultValue = defaultValue; if (goname == null) { goname = key; } 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 bgmSlider = gop.transform.FindChild("Option/Scroll View/SetVolume/SetBgmInfo").gameObject; GameObject copy = NGUIUtil.SetCloneChild(parent, bgmSlider, goname); container = copy; this.slider = copy.GetComponentInChildren <UISlider>(); if (eventDelegate != null) { eventDelegate.parameters[0] = new EventDelegate.Parameter(this); this.slider.onChange.Clear(); this.slider.onChange.Add(eventDelegate); } this.slider.value = this.value; } }
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(); } }
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(); } }