private void SelectNodeAnd(Action <Node> callback) { var nodesView = new NodesListView() { MinWidth = 500 }; var nodes = _manager.GetNodes().Where(x => x.Controller.Equals(controllersListView.SelectedController)).ToArray(); nodesView.RefreshWith(nodes); var dialogView = new DialogView(nodesView); nodesView.SelectionChanged += (o, e) => { dialogView.Close(); callback(nodesView.SelectedNode); }; dialogView.Show(mainGrid); }
/// <summary> /// 取消匹配 /// </summary> /// <param name="bytes"></param> private void CancelMatching(byte[] bytes) { CancelMatchingS2C package = NetMgr.Instance.DeSerializes <CancelMatchingS2C>(bytes); if (package.status == (int)ErrorCode.SUCCESS) { UIManager.Instance.HideUI(UIViewID.MATCHING_VIEW); } else { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "取消匹配失败"; dialogVO.content = "取消匹配失败,请检查网络连接"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
private void BtCreateScenario_Click(object sender, RoutedEventArgs e) { ThroughScenarioSave(() => { var selectScenarioTypeControl = new NewScenarioSelectionView(); var dialogView = new DialogView(selectScenarioTypeControl); dialogView.Show(); selectScenarioTypeControl.SingleActionScenario += async() => { BeginInitScenario(); dialogView.Close(); await NewScenario(new SingleActionScenario()); EndInitScenario(); }; selectScenarioTypeControl.RemoteScenario += async() => { BeginInitScenario(); dialogView.Close(); await NewScenario(new RemoteScenario()); EndInitScenario(); }; selectScenarioTypeControl.CompositeScenario += () => { BeginInitScenario(); dialogView.Close(); var selectCompositeScenarioType = new NewCompositeScenarioSelectionView(); var dialogViewComposite = new DialogView(selectCompositeScenarioType); selectCompositeScenarioType.Selected += async(valueType) => { dialogViewComposite.Close(); var scenario = new CompositeScenario() { ValueType = valueType }; await NewScenario(scenario); }; dialogViewComposite.Show(); EndInitScenario(); }; }); }
public virtual void Submit(DialogView dialogView, DialogBean dialogData) { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (storeInfo == null) { return; } if (dialogView as PickForNumberDialogView) { PickForNumberDialogView pickForNumberDialog = dialogView as PickForNumberDialogView; long number = pickForNumberDialog.GetPickNumber(); if (!gameData.HasEnoughMoney(storeInfo.price_l * number, storeInfo.price_m * number, storeInfo.price_s * number)) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1005)); return; } if (!gameData.HasEnoughGuildCoin(storeInfo.guild_coin * number)) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1012)); return; } if (!gameData.HasEnoughTrophy(storeInfo.trophy_elementary * number, storeInfo.trophy_intermediate * number, storeInfo.trophy_advanced * number, storeInfo.trophy_legendary * number)) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1021)); return; } gameData.PayMoney(storeInfo.price_l * number, storeInfo.price_m * number, storeInfo.price_s * number); gameData.PayGuildCoin(storeInfo.guild_coin * number); gameData.PayTrophy(storeInfo.trophy_elementary * number, storeInfo.trophy_intermediate * number, storeInfo.trophy_advanced * number, storeInfo.trophy_legendary * number); //加上获取数量 int getNumber = 1; if (storeInfo.get_number != 0) { getNumber = storeInfo.get_number; } gameData.AddItemsNumber(storeInfo.mark_id, number * getNumber); ToastHandler.Instance.ToastHint(ivIcon.sprite, string.Format(TextHandler.Instance.manager.GetTextById(1010), itemsInfo.name + "x" + (number * getNumber))); RefreshUI(); } }
public static void Show(Action <UserBase[]> callback, string[] selectedUsersIds, bool hideButtons = false) { if (!Repository.Users.Any()) { MessageView.ShowMessage("Пользователи не созданы!", "Выбор пользователей", Icons.Icon.Warning); } else { var control = new UsersSelectView(selectedUsersIds, hideButtons); var dialogView = new DialogView(control); dialogView.Caption = "Выберите пользователей"; control.ApplyClicked += () => { callback?.Invoke(control.SelectedUsers); dialogView.Close(); }; dialogView.Show(); } }
/// <summary> /// 报名成功消息 /// </summary> /// <param name="bytes"></param> private void ApplySucceed(byte[] bytes) { ApplyCompetitionS2C package = NetMgr.Instance.DeSerializes <ApplyCompetitionS2C>(bytes); if (package.status == 1) { HallInfo.arenaStatus = 1; Facade.SendNotification(NotificationConstant.MEDI_HALL_APPLYSUCCEED); } else { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "报名失败"; dialogVO.content = "报名失败,请检查网络连接"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
public void Submit(DialogView dialogView, DialogBean dialogBean) { if (dialogBean.dialogPosition == 0) { //删除确认 GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (infiniteTowersData.isSend) { foreach (string memberId in infiniteTowersData.listMembers) { CharacterBean characterData = gameData.GetCharacterDataById(memberId); characterData.baseInfo.SetWorkerStatus(WorkerStatusEnum.Rest); } } infiniteTowersData.proForSend = -1; gameData.RemoveInfiniteTowersData(infiniteTowersData); uiComponent.RefreshUI(); } }
private void OnEnable() { if (isTalk) { isReset = false; _machine.RegisterState(new Boss_BulletState("bullet", this)); _machine.RegisterState(new Boss_AttackState("attack", this)); _machine.RegisterState(new Boss_AirAttackState("airattack", this)); Timer.Register(2, () => { _anim.SetTrigger("disappear"); }); Timer.Register(3, () => { ReleaseSkill(); }); } else { NPC npc = ConfigManager.npc_config.npcs.Find((a) => { return(a.ID == 102); }); DialogView view = UIManager._instance.OpenView <DialogView>(); view.SetContenct(npc._callback_name, npc.talks.ToArray()); } }
/// <summary> /// 加入房间响应 /// </summary> /// <param name="bytes"></param> private void JoinRoomResponse(byte[] bytes) { JoinInRoomS2C package = NetMgr.Instance.DeSerializes <JoinInRoomS2C>(bytes); if (package.clientCode == (int)ErrorCode.SUCCESS) { this.HallInfo.Innings = package.roomRounds; this.HallInfo.GameRule = (GameRule)package.roomRule; this.HallInfo.BattleSeverIP = package.roomServerIp; this.HallInfo.BattleSeverPort = package.roomServerPort; this.HallInfo.Seat = package.seat; NSocket.RoomId = HallInfo.RoomCode == "" ? 0 : int.Parse(HallInfo.RoomCode); this.BattleServerConnect(NotificationConstant.MEDI_HALL_CUTJOINSCENE); } else if (package.clientCode == (int)ErrorCode.NO_ROOM) { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "加入提示"; dialogVO.content = "房间不存在"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } else if (package.clientCode == (int)ErrorCode.OVERFLOW_ROOM_PLAYERS) { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "加入提示"; dialogVO.content = "房间人数已满!"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } else { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "加入房间失败"; dialogVO.content = "加入房间失败,请检查网络连接"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
/// <summary> /// 刷新签到界面 /// </summary> private void RefreshSignInInfo() { HallProxy hallProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy; if (hallProxy.HallInfo.SignInState == (int)ErrorCode.SUCCESS) { for (int i = 0; i < hallProxy.HallInfo.SignInDay; i++) { Transform dayState = this.View.DataList[i]; if (i == hallProxy.HallInfo.SignInDay - 1) { SignInInfoAnimation(dayState); } else { dayState.FindChild("Unused").gameObject.SetActive(false); dayState.FindChild("Used").gameObject.SetActive(true); } } if (hallProxy.HallInfo.SignInDay >= 7) { this.View.SignInButton.transform.DOScale(Vector3.zero, 0.2f).SetEase(Ease.Linear).OnComplete( () => { this.View.SignInButton.transform.gameObject.SetActive(false); this.View.SignInButton.transform.localScale = Vector3.one; this.View.GetButton.transform.localScale = Vector3.zero; this.View.GetButton.gameObject.SetActive(true); this.View.GetButton.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.Linear); }); } } else { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "签到失败"; dialogVO.content = "今日已签到,请勿重复签到"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
public static void BeginCompositeScenarioSettings(CompositeScenario compositeScenario, Action <bool> callback) { var control = CreateControl(compositeScenario); var dialog = new DialogView((FrameworkElement)control); if (compositeScenario.ValueType is StateValueType) { dialog.Caption = "В данном окне можно настроить значение по умолчанию и статусы, " + "которые может принимать и возвращать данный сценарий. " + "Для того, чтобы добавить статус, нужно ввести в поле ввода " + "его название и нажать \"+\". Для выбора значения сценария по " + "умолчанию, нужно выбрать любой статус из списка."; } else if (compositeScenario.ValueType is FloatValueType) { dialog.Caption = "Выберите числовое значение, которое сценарий будет принимать при инициализации. Настройте максимальное и минимальное значение, которое можно задать сценарию."; } else { dialog.Caption = "Выберите значение, которое сценарий будет принимать при инициализации."; } bool ignoreCloseEvent = false; control.ApplyClicked += () => { ignoreCloseEvent = true; callback?.Invoke(true); dialog.Close(); }; dialog.Closed += (o, e) => { if (!ignoreCloseEvent) { callback?.Invoke(false); } }; dialog.Show(); }
public void Submit(DialogView dialogView, DialogBean dialogBean) { if (dialogBean.dialogPosition == 1) { //离开游戏 GameUtil.ExitGame(); } else if (dialogBean.dialogPosition == 2) { //回调主菜单 GameScenesHandler.Instance.ChangeScene(ScenesEnum.MainScene); GameCommonInfo.ClearData(); } else if (dialogBean.dialogPosition == 3) { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); GameDataHandler.Instance.manager.GetGameDataByUserId(gameData.userId); GameCommonInfo.ClearData(); GameScenesHandler.Instance.ChangeScene(ScenesEnum.GameInnScene); } }
public ReusableDialog(DialogView view) { _dlgView = view; _overlayView = new UIView() { BackgroundColor = _dlgView.OverlayColor.ToUIColor(), Opaque = false, Alpha = 0f }; var touchGesture = new TouchBeginGestureRecognizer(); touchGesture.AddTarget(() => DimmingViewTapped(touchGesture)); _overlayView.AddGestureRecognizer(touchGesture); // Because the process can't be executed until application completely loads, // set the action here to execute later on. OnceInitializeAction = Initialize; }
private void itemView_Click(object sender, EventArgs e) { var controlSlider = new FloatViewSliderSwitch(_model); var dialogSlider = new DialogView(controlSlider); controlSlider.ManualInputActivate += (o1, e1) => { _currentContext.Post((s) => { dialogSlider.Close(); var controlManual = new FloatViewManualSwitch(_model); var dialogManual = new DialogView(controlManual); controlManual.ApplyClicked += (o2, e2) => { _model.ScenarioValue = e2.Value; dialogManual.Close(); }; dialogManual.Show(Helper.GetLastParent(this)); }, null); }; dialogSlider.Show(Helper.GetLastParent(this)); }
/// <summary> /// 连接超时 /// </summary> /// <param name="socket"></param> void OnRquestTimeOut() { if (isShowTimeOut) { return; } isShowTimeOut = true; DialogMsgVO dialogMsgVO = new DialogMsgVO(); dialogMsgVO.title = "超时提示"; dialogMsgVO.content = "消息超时是否重新连接"; dialogMsgVO.dialogType = DialogType.CONFIRM; dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); }; dialogMsgVO.cancelCallBack = delegate { isShowTimeOut = false; }; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogMsgVO; waitMsgList.Clear(); UIManager.Instance.SetWaitIconActive(false); }
public void Submit(DialogView dialogView, DialogBean dialogBean) { int buyNumber = int.Parse(etNumber.text); IngredientsEnum ingType = (IngredientsEnum)goodsData.mark_type; GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (buyNumber <= 0) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1017)); return; } if (!gameData.HasEnoughMoney(price_l * buyNumber, price_m * buyNumber, price_s * buyNumber)) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1005)); return; } gameData.PayMoney(price_l * buyNumber, price_m * buyNumber, price_s * buyNumber); gameData.AddIng(ingType, buyNumber); RreshData(); ToastHandler.Instance.ToastHint(ivIcon.sprite, string.Format(TextHandler.Instance.manager.GetTextById(1018), buyNumber, goodsData.name, tvPirce.text)); }
private void CodebookExecute(Type obj) { DialogView dw2 = null; if (typeof(MembershipType) == obj) { dw2 = new DialogView(new DialogReferentViewModel <MembershipType>("Šifrarnik: članstvo")); } else if (typeof(AffiliationFeeType) == obj) { dw2 = new DialogView(new DialogReferentViewModel <AffiliationFeeType>("Šifrarnik: članarina - todo clanarina kosta")); } else if (typeof(MemberFunction) == obj) { dw2 = new DialogView(new DialogReferentViewModel <MemberFunction>("Šifrarnik: funkcija")); } else if (typeof(Section) == obj) { dw2 = new DialogView(new DialogReferentViewModel <Section>("Šifrarnik: sekcije")); } else if (typeof(AchievementType) == obj) { dw2 = new DialogView(new DialogReferentViewModel <AchievementType>("Šifrarnik: medalje")); } else if (typeof(MemberCategory) == obj) { dw2 = new DialogView(new DialogReferentViewModel <MemberCategory>("Šifrarnik: kategorije")); } else if (typeof(EmploymentStatus) == obj) { dw2 = new DialogView(new DialogReferentViewModel <EmploymentStatus>("Šifrarnik: status")); } if (dw2 != null) { dw2.Owner = Application.Current.MainWindow; dw2.WindowStartupLocation = WindowStartupLocation.CenterOwner; dw2.ShowDialog(); } }
void IActivatable.Activate(GameObject target) { // Get the dialog component of the listener, so we can use it's NpcRecord player = target.GetComponent <Character>(); // Get the npc greeting, as if there is no greeting, the Npc can't be talked to. var greeting = DialogRecord.GetDialogInfo(DialogType.Greeting, Npc, player); if (greeting == null) { return; } // Check if the listener knows the current topic, otherwise it will not be available // This could be done within the same loop as getting the dialog topic topics = DialogRecord.GetDialog(Npc, player); var knownTopics = new List <DialogRecord>(); foreach (var topic in topics) { // Only show topics that the player knows if (player.Journal.Topics.ContainsKey(topic.name)) { knownTopics.Add(topic); } } // Display services var services = GetComponents <CharacterService>(); // Load the dialog and instantiate dialogView = DialogView.Create(this, record.FullName, knownTopics, services, Npc.GetDisposition(player)); // Process the greeting after getting topics, or there will be no topics to check against DisplayInfo(null, greeting); // Set this last, so it isn't true the first time the player talks to an Npc. GetComponent <Character>().HasTalkedToPlayer = true; }
private void MainMenuButtonPressed(MainMenuButton obj) { switch (obj) { case MainMenuButton.Unknown: break; case MainMenuButton.Members: ContentArea = new MembersViewModel(); break; case MainMenuButton.Activities: ContentArea = new ActivitiesViewModel(); break; case MainMenuButton.Finances: DialogView dw = new DialogView(new DialogReferentViewModel <MemberCategory>("Šifrarnik: članstvo")); dw.Owner = Application.Current.MainWindow; dw.WindowStartupLocation = WindowStartupLocation.CenterOwner; dw.ShowDialog(); break; case MainMenuButton.Documents: DialogView dw2 = new DialogView(new DialogReferentViewModel <MemberFunction>("Šifrarnik: funkcija")); dw2.Owner = Application.Current.MainWindow; dw2.WindowStartupLocation = WindowStartupLocation.CenterOwner; dw2.ShowDialog(); break; case MainMenuButton.Economat: break; case MainMenuButton.Home: ContentArea = new HomeViewModel(); break; default: throw new ArgumentOutOfRangeException(nameof(obj), obj, null); } }
public T CreateDialog <T>(DialogEnum dialogType, Action <DialogView, DialogBean> actionSubmit, Action <DialogView, DialogBean> actionCancel, DialogView.IDialogCallBack callBack, DialogBean dialogBean, float delayDelete) where T : DialogView { string dialogName = EnumUtil.GetEnumName(dialogType); GameObject objDialogModel = manager.GetDialogModel(dialogName); if (objDialogModel == null) { LogUtil.LogError("没有找到指定Dialog:" + dialogName); return(null); } GameObject objDialog = Instantiate(gameObject, objDialogModel); if (objDialog) { DialogView dialogView = objDialog.GetComponent <DialogView>(); if (dialogView == null) { Destroy(objDialog); } dialogView.SetCallBack(callBack); dialogView.SetAction(actionSubmit, actionCancel); dialogView.SetData(dialogBean); if (delayDelete != 0) { dialogView.SetDelayDelete(delayDelete); } //改变焦点 EventSystem.current.SetSelectedGameObject(objDialog); manager.AddDialog(dialogView); return(dialogView as T); } else { LogUtil.LogError("没有实例化Dialog成功:" + dialogName); return(null); } }
/// <summary> /// Waits until a function evaluates to <c>true</c>. /// Shows a dialog. /// </summary> /// <param name="function">The function to evaluate.</param> /// <param name="condition">The condition to evaluate on the functions return value.</param> /// <param name="expectationText">Text that explains the function's expectation.</param> /// <param name="negativeTimeout">The negative timeout.</param> /// <param name="positiveTimeout">The positive timeout.</param> /// <param name="pollingPeriod">The polling time.</param> /// <param name="clickThrough">Whether to enable click-through mode.</param> /// <param name="actionText">The action text.</param> private void Forr <T>(Func <T> function, Predicate <T> condition, string expectationText, TimeSpan negativeTimeout, TimeSpan positiveTimeout, TimeSpan pollingPeriod, bool clickThrough, string actionText) { // init state = State.init; this.positiveTimeout = positiveTimeout; this.negativeTimeout = negativeTimeout; uic = new DialogView(negativeTimeout != TimeSpan.MaxValue, positiveTimeout != TimeSpan.MaxValue && positiveTimeout != TimeSpan.Zero, clickThrough, function != null, actionText); // spawn var c = new CancellationTokenSource(); Task ui = new Task(() => uic.UI(() => OnDialogLoad(expectationText, actionText), OnBadClick, OnGoodClick)); Task ti = new Task(() => Timer(c.Token)); Task po = new Task(() => Evaluator(c.Token, function, condition, pollingPeriod)); // join ui.Start(); ti.Start(); po.Start(); ui.Wait(); c.Cancel(); ti.Wait(); po.Wait(); switch (state) { case State.good_userexit: case State.good_timedout: return; case State.bad_timedout: throw new DialogWaitForTimeoutException(expectationText, negativeTimeout); case State.bad_userexit: throw new DialogWaitForAbortedException(expectationText); default: throw new InvalidOperationException(state.ToString()); } }
public MainPage() { InitializeComponent(); Singleton.Clear <INotificationsHandler>(); Singleton.Add(this); tabsView.AddTabInfo(new SliderTabsView.TabInfo(connectionSettingsSlider, LazuriteUI.Icons.Icon.KeyOld)); tabsView.AddTabInfo(new SliderTabsView.TabInfo(settingsSlider, LazuriteUI.Icons.Icon.Settings)); tabsView.AddTabInfo(new SliderTabsView.TabInfo(messagesSlider, LazuriteUI.Icons.Icon.EmailMinimal)); _supportsResume.StateChanged = (sender, currentState, previousState) => { // Do not reinit when app was "home button pressed" if (currentState == SupportsResumeState.Paused) { DialogView.CloseAllDialogs(); } if (previousState == SupportsResumeState.Closed || previousState == SupportsResumeState.Stopped) { InitializeManager(); } }; connectionView.ConnectClicked += ConnectionView_ConnectClicked; _manager.ConnectionError += _manager_ConnectionError; _manager.NeedRefresh += _manager_NeedRefresh; _manager.ConnectionLost += _manager_ConnectionLost; _manager.ConnectionRestored += _manager_ConnectionRestored; _manager.NeedClientSettings += _manager_NeedClientSettings; _manager.LoginOrPasswordInvalid += _manager_LoginOrPasswordInvalid; _manager.BruteforceSuspition += _manager_BruteforceSuspition; _manager.CredentialsLoaded += _manager_CredentialsLoaded; _manager.SecretCodeInvalid += _manager_SecretCodeInvalid; _manager.ScenariosChanged += _manager_ScenariosChanged; ShowCaption(); }
/// <summary> /// 当连接断开 /// </summary> void OnDisconnect(NSocket socket) { if (!ConnentionDic.ContainsValue(socket)) { return; } if (isShowTimeOut) { return; } isShowTimeOut = true; DialogMsgVO dialogMsgVO = new DialogMsgVO(); dialogMsgVO.title = "连接提示"; dialogMsgVO.content = "您已断开连接是否重新连接"; dialogMsgVO.dialogType = DialogType.CONFIRM; dialogMsgVO.confirmCallBack = delegate { ConfirmReConnect(); }; dialogMsgVO.cancelCallBack = delegate { CancelReConnect(); }; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogMsgVO; }
public void ShowCaption(string text = "", bool showLoadingGrid = true, bool showTextOnLoadingGrid = true, bool showLoadingAnimation = true) { // Close dialogviews DialogView.CloseAllDialogs(all: false); if (showLoadingGrid) { gridCaption.IsVisible = true; if (showLoadingAnimation) { iconAnimation.StartAnimate(); } else { iconAnimation.StopAnimate(); } } lblCaption.Text = showTextOnLoadingGrid ? text : string.Empty; connectionView.SetErrorMessage(text); }
private void ItemView_Click(object sender, EventArgs e) { var model = (SwitchScenarioModel)BindingContext; var statusSwitch = new StatusViewSwitch(model); var dialog = new DialogView(statusSwitch); statusSwitch.StateChanged += (o, args) => { if (args.Value == ItemView.ClickSource.CloseAnyway) { dialog.Close(); } if ((args.Value == ItemView.ClickSource.Tap && model.AcceptedValues.Length <= StatusViewSwitch.NotClosingItemsCount) || args.Value == ItemView.ClickSource.CloseAnyway) // Если количество возможных значений меньше 14, { // то при выборе одного из значений закрываем окно. dialog.Close(); // Число подобрано на основе того, сколько строчек вмещается на экран. } }; dialog.Show(DialogView.GetDialogHost(this)); }
/// <summary> /// 创建弹窗 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="dialogBean"></param> /// <param name="delayDelete"></param> /// <returns></returns> public T CreateDialog <T>(DialogBean dialogBean) where T : DialogView { string dialogName = dialogBean.dialogType.GetEnumName(); GameObject objDialogModel = GetDialogModel(dialogName); if (objDialogModel == null) { LogUtil.LogError("没有找到指定Dialog:" + dialogName); return(null); } Transform tfContainer = GetUITypeContainer(UITypeEnum.Dialog); GameObject objDialog = Instantiate(tfContainer.gameObject, objDialogModel); if (objDialog) { DialogView dialogView = objDialog.GetComponent <DialogView>(); if (dialogView == null) { Destroy(objDialog); } dialogView.SetCallBack(dialogBean.callBack); dialogView.SetAction(dialogBean.actionSubmit, dialogBean.actionCancel); dialogView.SetData(dialogBean); if (dialogBean.delayDelete != 0) { dialogView.SetDelayDelete(dialogBean.delayDelete); } //改变焦点 EventSystem.current.SetSelectedGameObject(objDialog); dialogList.Add(dialogView); return(dialogView as T); } else { LogUtil.LogError("没有实例化Dialog成功:" + dialogName); return(null); } }
/// <summary> /// 更新用户数据 /// </summary> /// <param name="bytes"></param> private void GetUserInfoResponse(byte[] bytes) { GetUserInfoS2C package = NetMgr.Instance.DeSerializes <GetUserInfoS2C>(bytes); this.userName = package.userName; foreach (UserItem item in package.userItems) { if (!this.userItems.ContainsKey(item.type)) { this.userItems.Add(item.type, item); } else { var hallProxy = ApplicationFacade.Instance.RetrieveProxy(Proxys.HALL_PROXY) as HallProxy; if (item.amount > this.userItems[item.type].amount && hallProxy.orderTimeId > 0) { DialogMsgVO dialogMsgVO = new DialogMsgVO(); dialogMsgVO.title = "充值提示"; dialogMsgVO.content = "充值成功"; dialogMsgVO.dialogType = DialogType.ALERT; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogMsgVO; Timer.Instance.CancelTimer(hallProxy.orderTimeId); hallProxy.orderTimeId = 0; } this.userItems[item.type] = item; } } this.showID = package.showId; //string ip = package.ip; //ip = ip.Substring(0, ip.Length - 5); //ip = ip.Replace("/", ""); this.localIP = package.ip; this.headIconUrl = package.imageUrl; this.sex = package.sex; this.boundAgency = package.boundAgency; SendNotification(NotificationConstant.MEDI_HALL_REFRESHUSERINFO); }
/// <summary> /// 创建房间响应 /// </summary> /// <param name="bytes"></param> private void CreateRoomResponse(byte[] bytes) { CheckCreateRoomS2C package = NetMgr.Instance.DeSerializes <CheckCreateRoomS2C>(bytes); if (package.clientCode == (int)ErrorCode.SUCCESS) { this.HallInfo.BattleSeverIP = package.roomServerIp; this.HallInfo.BattleSeverPort = package.roomServerPort; this.HallInfo.RoomCode = package.roomCode; this.HallInfo.Seat = package.seat; NSocket.RoomId = HallInfo.RoomCode == "" ? 0 : int.Parse(HallInfo.RoomCode); this.BattleServerConnect(NotificationConstant.MEDI_HALL_CUTCREATESCENE); } else { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "创建房间失败"; dialogVO.content = "创建房间失败,请检查网络连接"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
/// <summary> /// 匹配 /// </summary> /// <param name="bytes"></param> private void StartMatching(byte[] bytes) { JoinCompetitionS2C package = NetMgr.Instance.DeSerializes <JoinCompetitionS2C>(bytes); if (package.status == 1) { Debug.Log("开始匹配"); UIManager.Instance.HideUI(UIViewID.ATHLETICS_VIEW, () => { UIManager.Instance.ShowUI(UIViewID.MATCHING_VIEW); }); } else if (package.status == 0) { DialogMsgVO dialogVO = new DialogMsgVO(); dialogVO.dialogType = DialogType.ALERT; dialogVO.title = "匹配失败"; dialogVO.content = "匹配失败,请检查网络连接"; DialogView dialogView = UIManager.Instance.ShowUI(UIViewID.DIALOG_VIEW) as DialogView; dialogView.data = dialogVO; } }
void applyMotionEffects() { if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) { return; } UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis); horizontalEffect.MinimumRelativeValue = new NSNumber(-kCustomIOS7MotionEffectExtent); horizontalEffect.MaximumRelativeValue = new NSNumber(kCustomIOS7MotionEffectExtent); UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis); verticalEffect.MinimumRelativeValue = new NSNumber(-kCustomIOS7MotionEffectExtent); verticalEffect.MaximumRelativeValue = new NSNumber(kCustomIOS7MotionEffectExtent); UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup(); motionEffectGroup.MotionEffects = new UIMotionEffect[] { horizontalEffect, verticalEffect }; DialogView.AddMotionEffect(motionEffectGroup); }
public DialogChoiceView(string text, DialogView nextDialogView) { this.Text = text; this.NextDialog = nextDialogView; }
//------------------------------------------------------------------------------ /// <summary> /// Init the components /// </summary> void Awake() { DialogView[] diaComps; diaComps = gameObject.GetComponentsInChildren<DialogView>(); Log.Assert(diaComps.Length == 1, "Missing or two many DialogView found:"+ diaComps.Length+" in children of "+gameObject.name); dialogView = diaComps[0]; }