private void AddButtonClick() { SubCom.GetChild("Exit").onClick.Add(OnExit); SubCom.GetChild("Cancel").onClick.Add(OnExit); SubCom.GetChild("Ok").onClick.Add(OnOk); SubCom.GetChild("Ok1").onClick.Add(OnOk); }
public override void ForceRefresh(object userData) { UserDialogParams = userData as DialogParams; if (UserDialogParams == null) { return; } Title = UserDialogParams.Title == null ? Title : UserDialogParams.Title; Mode = UserDialogParams.Mode == 0 ? 2 : UserDialogParams.Mode; Mode = Mathf.Min(Mathf.Max(1, Mode), 2); Title = string.IsNullOrEmpty(Title) ? "" : Title; modeCtl.SetSelectedIndex(Mode - 1); TitleLabel = SubCom.GetChild("title").asTextField; TitleLabel.text = Title; AddButtonClick(); var label = GComponent.GetChild("label"); if (label != null) { label.text = UserDialogParams.Message; } UserData = UserDialogParams.UserData; if (UserData != null && UserData is object[]) { var objs = UserData as object[]; if (objs.Length >= 4) { Vector3 pos = (Vector3)objs[1] + new Vector3(150, 0); //当前的l位置 Vector2 size = (Vector2)objs[2]; //限定范围宽度 Vector2 gPos = (Vector2)objs[3]; //当前所在范围内的 g位置 mOldPos = GComponent.GlobalToLocal(gPos) + new Vector2(150, 0); //当前所在的本地的老位置 ShowPos(pos, size); } } }