public void OnFireSliderDrag(BaseEventData data) { PointerEventData ped = data as PointerEventData; Vector3 delta = ped.delta; Vector3 pp = BaseUIController.GetUICamera().WorldToScreenPoint(m_SliderButton.transform.position); pp.y += delta.y; m_SliderButton.transform.position = BaseUIController.GetUICamera().ScreenToWorldPoint(pp); Vector3 p = m_SliderTrans.localPosition; p.y = Mathf.Clamp(p.y, -m_MaxPower, 0);//y position is negative m_SliderTrans.localPosition = p; float percentage = p.y / -m_MaxPower; DiscreteValue(ref percentage); //float power = Mathf.Lerp(0, 1, percentage); //Debug.Log("power : " + power); m_Background.color = Color.Lerp(m_MinColor, m_MaxColor, percentage); if (OnSliderValueChange != null && m_LastValue != percentage) { OnSliderValueChange(percentage); } m_LastValue = percentage; }
public BootPageViewController(BaseUIController uiController, uint pageNumber, string title) : base(uiController, pageNumber, title) { _progressGuage = new UIGuage(this, Analogs.PageBootProgressLevel); _statusLabel = new UILabel(this, Serials.PageBootStatus); uiController.System.SystemStartupProgressChange += SystemOnSystemStartupProgressChange; }
public void RegisteController(BaseUIController controller) { if (!controllerMaps.ContainsKey(controller.GetType())) { this.controllerMaps[controller.GetType()] = controller; } }
//public void ShowFormFromID(UIConsts.FORM_ID id) //{ // if (IsOpened(id)) // { // return; // } // // turn on clicks catcher // _uiCreator.ClicksCatcher.SetActive(true); // _uiCreator.ClicksCatcher.transform.SetAsLastSibling(); // // // GameObject windowObj = _uiCreator.GetFormFromID(id); // windowObj.SetActive(true); // windowObj.SendMessage("Show"); // windowObj.transform.SetAsLastSibling(); // BaseUIController window = windowObj.GetComponent<BaseUIController>(); // WindowsQueue.Add(window); // GameManager.Instance.EventManager.CallOnShowWindowEvent(); //} public void ShowFormFromID(UIConsts.FORM_ID id, EventData e) { if (id != UIConsts.FORM_ID.TUTOR_WINDOW && IsOpened(id)) { // only tutorial can be opened many times return; } if (!_uiCreator.WindowExists(id)) { _uiCreator.CreateWindow(GetFormDataByID(id)); } GameObject windowObj = _uiCreator.GetFormFromID(id); if (windowObj == null) { return; } BaseUIController window = windowObj.GetComponent <BaseUIController>(); if (window.OpenForm(e) == true) { // turn on clicks catcher _uiCreator.ShowClicksCatcher(GetFormDataByID(id).FaderType); // windowObj.SetActive(true); windowObj.SendMessage("Show"); windowObj.transform.SetAsLastSibling(); WindowsQueue.Add(window); GameManager.Instance.EventManager.CallOnShowWindowEvent(); } }
void OnGUI() { if (GUILayout.Button("Generate tips")) { BaseUIController.GenerateTips("100", Color.yellow, MathTools.World2UI(Pools.CueBall.GetPosition())); } }
void OnDestroy() { PoolRulesBase.onFireBall -= OnFireBall; PoolRulesBase.onNewTurn -= OnStartRound; m_Instance = null; GameStatistics.Serialize(); HOAudioManager.StopLoopClip(); }
public ActionSheetDefault(BaseUIController uiController, uint joinNumber) : base(uiController, new ASubPage(uiController, uiController.Device.BooleanInput[joinNumber], string.Empty, TimeSpan.Zero), uiController.Device.SmartObjects[Joins.SmartObjects.ActionSheetButtonsDefault], new UILabel(uiController.Device, Serials.ActionSheetTitle), new UILabel(uiController.Device, Serials.ActionSheetSubTitle)) { _timeRemainingLabel = new UILabel(uiController.Device, Serials.ActionSheetTimeRemaining); }
public void Init(GameObject go, BaseUIController controller) { if (go != null) { this.GameObject = go; this.Transform = this.GameObject.transform; } InitPanelDepth(); }
public void Update() { Dictionary <Type, BaseUIController> .Enumerator iter = controllerMaps.GetEnumerator(); while (iter.MoveNext()) { BaseUIController controller = iter.Current.Value; controller.Update(); } }
public T GetUIController <T>() where T : BaseUIController { BaseUIController controller = null; if (controllerMaps.TryGetValue(typeof(T), out controller)) { Debug.LogWarning("get controller error : " + typeof(T).ToString()); } return(controller as T); }
public void ReleaseAll() { Dictionary <Type, BaseUIController> .Enumerator iter = controllerMaps.GetEnumerator(); while (iter.MoveNext()) { BaseUIController controller = iter.Current.Value; controller.Hide(); controller.Destroy(); } }
public UserPageViewController(BaseUIController uiController) : base(uiController, Digitals.PageUser, string.Empty) { _vcView = new VCViewController(this); _openPreviewBtn = new UIButton(this, Digitals.UserPageVideoOpenBtn); _closePreviewBtn = new UIButton(this, Digitals.UserPageVideoCloseBtn); _slider = new UISlider(this, Analogs.UserPageVolumeSlider, true); _muteBtn = new UIButton(this, Digitals.UserPageVolumeMuteBtn); UIController.RoomChange += UIControllerOnRoomChange; }
public T Show <T>() where T : BaseUIController { BaseUIController controller = FindUIControllerByType(typeof(T)); HideLayerObjects(controller); controller.Show(); return(controller as T); }
public BaseUIController FindUIControllerByType(Type type) { BaseUIController controller = null; if (controllerMaps.TryGetValue(type, out controller)) { Debug.LogWarning("cannot find controller : " + type.ToString()); } return(controller); }
bool RegisterController(BaseUIController controller) { if (!controller.Init()) { Debug.LogWarning("controller init fail : " + controller.ToString()); return(false); } else { UIManager.Instance.RegisteController(controller); return(true); } }
public void HideLayerObjects(BaseUIController controller) { Dictionary <Type, BaseUIController> .Enumerator iter = controllerMaps.GetEnumerator(); while (iter.MoveNext()) { BaseUIController temp = iter.Current.Value; if (temp == controller || temp.layer != controller.layer) { continue; } temp.Hide(); } }
public void RemoveController <T>() where T : BaseUIController { BaseUIController controller = null; if (controllerMaps.TryGetValue(typeof(T), out controller)) { Debug.LogWarning("remove controller not exist " + typeof(T)); } else { controllerMaps.Remove(typeof(T)); controller.Destroy(); } }
/// <summary> /// 隐藏UI界面 /// </summary> /// <param name="ui"></param> public void Hide(UIInstanceIDEnum uiInstanceID) { if (m_AllRegisterUI.Contains(uiInstanceID)) //如果界面有注册 { if (m_AllInstantiateUI.ContainsKey(uiInstanceID)) //如果界面生成过 { BaseUIView view = m_AllInstantiateUI[uiInstanceID].View; view.OnHide(); BaseUIController controller = view.GetComponent <BaseUIController>(); controller.OnHide(); view.gameObject.SetActive(false); } } else { LogManager.LogError("显示没有注册的界面:" + uiInstanceID); } }
/// <summary> /// 显示UI /// </summary> /// <param name="uiInstanceID">UI唯一实例ID</param> /// <param name="uiGameObject">UI界面游戏物体</param> /// <param name="args">传递参数</param> public void ShowUI(UIInstanceIDEnum uiInstanceID, object args = null) { if (m_AllRegisterUI.Contains(uiInstanceID)) //如果界面有注册 { if (!m_AllInstantiateUI.ContainsKey((UIInstanceIDEnum)uiInstanceID)) //如果界面没有生成过 { //根据界面枚举找到对应加载预制体的路径 //todo:这边应该是配置单独的模块进行配置加载和读取,而不是和其他关联 //if (FarmGameManager.Instance.m_UIPathConfig == null) //{ // LogManager.LogError("没有读取到界面配置"); // return; //} //foreach (var item in FarmGameManager.Instance.m_UIPathConfig.allUIPath) //{ // if (item.id == (int)uiInstanceID) // { // LogManager.Log("path=" + item.path); // GameObject uiGameObject = ResourceLoadManager.Instance.Load(item.path) as GameObject; // BaseUIView view = Instantiate(uiGameObject).GetComponent<BaseUIView>(); // view.UIInstanceID = (int)uiInstanceID; // view.OnCreated(args); // view.OnShow(args); // BaseUIController controller = view.GetComponent<BaseUIController>(); // controller.OnCreated(args); // controller.OnShow(args); //todo:在这边也进行model层的初始化 // m_AllInstantiateUI.Add((UIInstanceIDEnum)view.UIInstanceID, controller); // } //} } else//已经生成过界面 { BaseUIView view = m_AllInstantiateUI[uiInstanceID].View; view.OnShow(args); BaseUIController controller = view.GetComponent <BaseUIController>(); controller.OnShow(args); } } else { LogManager.LogError("显示没有注册的界面:" + uiInstanceID); } }
private void CalculateAnchorOffset(Vector3 position) { Vector2 vc = BaseUIController.GetUICamera().ScreenToWorldPoint(position); Vector2 coord, newCoord = m_SideballO.worldToLocalMatrix.MultiplyPoint(vc); float mag = newCoord.magnitude; float r = m_SideballO.rect.width * .5f - m_AnchorO.rect.width * .5f; if (mag > r) { float ang = Mathf.Acos(Mathf.Abs(newCoord.x) / mag); coord.x = r * Mathf.Cos(ang) * (newCoord.x >= 0 ? 1 : -1); coord.y = r * Mathf.Sin(ang) * (newCoord.y >= 0 ? 1 : -1); } else { coord = newCoord; } _SidingAnchorOffset(coord); }
public TechPageViewController(BaseUIController uiController) : base(uiController, Digitals.PageTechControl, string.Empty) { _navList = new NavIconMenu(uiController, uiController.Device.SmartObjects[1]); _navButtons = new ButtonCollection(_navList); _subPages = new List <IVisibleItem> { new DMRoutingViewController(this, Digitals.SubPageTechDmRouting, "AV Routing"), new SettingsViewController(this, Digitals.SubPageTechSettings, "System Settings"), new RecordingViewController(this), new PowerViewController(this), new RoomControlViewController(this), new TVControlViewController(this), new AudioFadersViewController(this), new VCViewController(this), new UsbRoutingViewController(this), new CameraControlViewController(this), }; _navList.AddItem(JSIcons.Power, "Power Control", _subPages.FirstOrDefault(s => s is PowerViewController)); _navList.AddItem(JSIcons.Video, "DM Routing", _subPages.FirstOrDefault(s => s.VisibleJoin.Number == Digitals.SubPageTechDmRouting)); _navList.AddItem(JSIcons.AudioLevels, "Audio Control", _subPages.FirstOrDefault(s => s is AudioFadersViewController)); if (UIController.System is ClassroomSystem || UIController.System is AuditoriumSystem) { _navList.AddItem(JSIcons.VideoConf, "Video Conference", _subPages.FirstOrDefault(s => s is VCViewController)); _navList.AddItem(JSIcons.Camera, "Cameras", _subPages.FirstOrDefault(s => s is CameraControlViewController)); _navList.AddItem(JSIcons.Recording, "Recording", _subPages.FirstOrDefault(s => s is RecordingViewController)); } _navList.AddItem(JSIcons.TV, "IPTV Control", _subPages.FirstOrDefault(s => s is TVControlViewController)); if (UIController.System is AuditoriumSystem) { _navList.AddItem(JSIcons.Lights, "Room Control", _subPages.FirstOrDefault(s => s is RoomControlViewController)); _navList.AddItem(JSIcons.Presets, "USB Routing", _subPages.FirstOrDefault(s => s is UsbRoutingViewController)); _navList.AddItem(JSIcons.Settings, "System Settings", _subPages.FirstOrDefault(s => s.VisibleJoin.Number == Digitals.SubPageTechSettings)); } }
public void AddScore(int score, PocketTrigger pocket) { int s = (int)(score * (m_PlayerData.Combo + 4) * .2f); Score += s; if (pocket) { string tips; if (Combo > 1) { tips = "COMBO x " + Combo + "\n+" + s; } else { tips = "+" + s; } BaseUIController.GenerateTips(tips, Color.yellow, MathTools.World2UI(pocket.GetRealPosition())); } }
void Awake() { if (m_Instance) { Debug.LogError("two " + gameObject.name + " in the scene. check the code"); } m_Instance = this; GameManager.CurrentUIRoot = GetComponent <Canvas>(); m_Text.gameObject.SetActive(false); //hand.gameObject.SetActive(false); m_FadeMask.SetActive(true); PoolRulesBase.onFireBall += OnFireBall; PoolRulesBase.onNewTurn += OnStartRound; if (!debugAI) { targetPocketImage.gameObject.SetActive(false); targetBallImage.gameObject.SetActive(false); hitPointImage.gameObject.SetActive(false); newHitPointImage.gameObject.SetActive(false); } }
public void AddCues(int cue, Vector3 position) { if (cue == 0) { return; } ShotsRemain += cue; Color c; string f = string.Format(HOLocalizationConfiguration.GetValue(113), cue); if (cue > 0) { c = Color.yellow; } else { m_PlayerData.Combo = 0; c = Color.red; } BaseUIController.GenerateTips(f, c, position); }
public void OnCueDrag(BaseEventData data) { PointerEventData pd = data as PointerEventData; Vector3 worldPosition = BaseUIController.GetUICamera().ScreenToWorldPoint(pd.position); Vector3 v = (worldPosition - m_MasseCue.position).normalized; int angle; if (Vector3.Cross(v, Vector3.right).z > 0) { angle = 0; } else { angle = (int)Vector3.Angle(Vector3.right, v); } angle = Mathf.Clamp(angle, 0, 90); if (m_PrevValue != angle) { m_PrevValue = angle; MasseAngle = angle; } }
void Awake() { if (m_Instance) { Debug.LogError("two " + gameObject.name + " in the scene. check the code"); } m_Instance = this; GameManager.CurrentUIRoot = GetComponent<Canvas>(); m_Text.gameObject.SetActive(false); //hand.gameObject.SetActive(false); m_FadeMask.SetActive(true); PoolRulesBase.onFireBall += OnFireBall; PoolRulesBase.onNewTurn += OnStartRound; if(!debugAI) { targetPocketImage.gameObject.SetActive(false); targetBallImage.gameObject.SetActive(false); hitPointImage.gameObject.SetActive(false); newHitPointImage.gameObject.SetActive(false); } }
public override void PotBall(PoolBall ball, PocketIndexes pocket) { base.PotBall(ball, pocket); if ((pocket & PocketTrigger.PunitivePocket) != 0) { //m_PunishmentCountThisRound++; m_Player.AddCues(ConstantData.PunitiveShots, PocketTrigger.GetPocketWithIndexes(pocket)); } if ((pocket & PocketTrigger.RewardPocket) != 0) { //m_RewardCountThisRound++; m_Player.AddCues(ConstantData.RewardShots, PocketTrigger.GetPocketWithIndexes(pocket)); } int score = 0; if (ball.ballType == BallType.WHITE) { m_Player.Combo = 0; m_Player.AddCues(ConstantData.MissionCueballPottedPunishment, PocketTrigger.GetPocketWithIndexes(pocket)); return; } else if (ball.ballType == BallType.BOMB) { score = ConstantData.MissionBombPottedPoint; } else if (ball.ballType == BallType.SINGULARITY) { score = ConstantData.MissionSingularityPottedPoint; } else if (ball.ballType == BallType.ABSORB) { score = ConstantData.MissionAbsorbPottedPoint; AbsorbBall b = (AbsorbBall)ball; for (int i = 0, count = b.AbsorbList.Count; i < count; i++) { PotBall(b.AbsorbList[i], pocket); Pools.StorageRack.Add(b.AbsorbList[i]); } b.AbsorbList.Clear(); } else if (ball.ballType == BallType.REDCUSTOM) { score = ConstantData.MissionRedBallPoint; } else if (ball.ballType == BallType.BLUECUSTOM) { score = ConstantData.MissionBlueBallPoint; } else if (ball.ballType == BallType.YELLOWCUSTOM) { score = ConstantData.MissionYellowBallPoint; } else if (ball.ballType == BallType.JIANGYOU) { score = ConstantData.MissionJiangYouBallPoint; } else if (ball.ballType == BallType.DEMON) { score = ConstantData.MissionDemonBallPoint; } if (score > 0) { m_Player.Combo++; m_Player.AddScore(score, PocketTrigger.GetPocketWithIndexes(pocket)); m_ScoreThisRound = score; } if (m_Player.Combo >= 5) { BaseUIController.GenerateTips("Great!"); } m_Player.Pot(); if (m_TargetBalls.Contains(ball.GetBallID())) { m_TargetBalls.Remove(ball.GetBallID()); } }
public ASubPageWithCloseButton(BaseUIController uiController, uint joinNumber, string title) : base(uiController, uiController.Device.BooleanInput[joinNumber], title, TimeSpan.FromSeconds(30)) { _backButton = new UIButton(uiController, Digitals.SubPageBackButton, Serials.SubPageBackButtonTitle); }
protected APage(BaseUIController uiController, uint pageNumber, string title) : base(uiController, pageNumber) { _title = title; _backButton = new UIButton(this, Digitals.PageBackButton, Serials.PageBackButtonTitle); }
public ActionSheetDefault(BaseUIController uiController) : this(uiController, Digitals.SubPageActionSheetDefault) { }
/// <summary> /// switch coordinate form world space to ui space /// </summary> /// <param name="v"></param> /// <returns></returns> public static Vector3 World2UI(Vector3 v) { Vector2 sp = Pools.SceneCamera.WorldToScreenPoint(v); return(BaseUIController.GetUICamera().ScreenToWorldPoint(sp)); }