public void ShowPanel(PanelType panelType, params object[] panelArgs) { if (panels.ContainsKey(panelType)) { current = panels[panelType]; current.gameObject.SetActive(false); current.OnInit(panelArgs); } else { GameObject scene = new GameObject(panelType.ToString()); current = scene.AddComponent(Type.GetType(panelType.ToString())) as PanelBase; current.gameObject.SetActive(false); current.OnInit(panelArgs); panels.Add(panelType, current); if (parentObj == null) { parentObj = GameObject.Find("UI Root").transform; } scene.transform.parent = parentObj; scene.transform.localEulerAngles = Vector3.zero; scene.transform.localScale = Vector3.one; scene.transform.localPosition = Vector3.zero; LayerMgr.GetInstance().SetLayer(current.gameObject, LayerType.Panel); } StartShowPanel(current, current.PanelShowStyle, true); }
private void initPanelBase(PanelBaseName panelBaseName) { if (panelBases.ContainsKey(panelBaseName.ToString())) { Debug.LogWarning("[PanelBaseMng.initPanelBase]" + panelBaseName + "已初始化过!"); return; } GameObject go = LocalDataTool.ResLoad(PBDIR + panelBaseName) as GameObject; go = Instantiate <GameObject>(go); go.name = panelBaseName.ToString(); PanelBase pb = go.GetComponent <PanelBase>(); go.transform.SetParent(transform.GetChild((int)pb.Layer), false); panelBases.Add(panelBaseName.ToString(), pb); pb.Init(); }
private void OnButtonClicked(ToolbarButton button, ToolbarButton[] buttons) { UnfocusButtons(buttons); if (_currentPanel != null) { bool same = button.Category == _currentPanel.Category; Destroy(_currentPanel.gameObject); _currentPanel = null; if (same) { return; } } _currentPanel = CreatePanel(button.Category); SetButtonFocused(button); RefreshZOrder(); }
private static StackContainer GenerateStackContainer( IEnumerable <IViewModel> viewModels, string header, Orientation orientation, bool wrapUpEachViewModelInTabContainer) { var panels = new List <IPanel>(); foreach (IViewModel viewModel in viewModels) { var panel = new PanelBase { PanelContent = (IPanelContent)viewModel.Clone(), }; panels.Add(panel); } return(GenerateStackContainer(panels, header, orientation, wrapUpEachViewModelInTabContainer)); }
private void CreateSelectMixPanel() { _selectMixPanel = AddUIComponent <PanelBase>(); _selectMixPanel.Setup("Select Mix Panel", 350.0f, 0.0f, 5, true, LayoutDirection.Vertical, LayoutStart.TopLeft, "WhiteRect"); _selectMixPanel.color = UIColorGrey; _selectMixPanel.CreateSpace(0.0f, 0.01f); CreateLabel(_selectMixPanel, Translation.Instance.GetTranslation(TranslationID.LABEL_SELECTMIX)); _selectMixPanel.CreateSpace(0.0f, 0.01f); CreateDropDown(); _selectMixPanel.CreateSpace(0.0f, 0.01f); CreateUseAsDefaultCheckbox(); _selectMixPanel.CreateSpace(0.0f, 0.01f); CreateLoadButton(); _selectMixPanel.CreateSpace(0.0f, 5.0f); CreateSubscribeButton(); _selectMixPanel.CreateSpace(0.0f, 5.0f); RefreshDropdown(); }
public void OnLevelItemClicked() { PanelBase panel = GameController.Instance.PanelController.Panels[PanelName.LevelLobbyPanel]; for (int i = 0; i < 4; i++) { GameObject player = GameController.Instance.Players[i]; player.SetActive(true); player.GetComponent <PlayerController>().CanvasContainer.gameObject.SetActive(false); player.GetComponent <PlayerController>().PhysicsContainer.gameObject.SetActive(false); player.GetComponent <Rigidbody2D>().simulated = false; } LevelLobbyPanel slp = (LevelLobbyPanel)panel; slp.StartLevel(levelType, LevelBackground); }
private PanelBase CreateInst(PanelType type) { if (_panelDic.ContainsKey(type)) { _panelDic[type].OnEnter(); return(_panelDic[type]); } GameObject obj = GameObject.Instantiate(Resources.Load(_panelPathDic[type])) as GameObject; obj.transform.parent = _trans; PanelBase panel = obj.GetComponent <PanelBase>(); panel.OnEnter(); _panelDic.Add(type, panel); return(panel); }
/// <summary> /// 是否还有全屏显示的UI。 /// </summary> public bool IsHaveFullView() { bool ret = false; var e = panelDic.GetEnumerator(); while (e.MoveNext()) { PanelBase panel = e.Current.Value; if (panel.IsShown && panel.mCfg.fullview) { ret = true; break; } } e.Dispose(); return(ret); }
public void ClosePanel(PanelType panel) { int index = (int)panel; GameObject panelGo; if (PanelDic.TryGetValue(index, out panelGo) && panelGo is object) { PanelBase panelScript = panelGo.GetComponentInChildren <PanelBase>(); if (panelScript is object) { if (PanelStack.Contains(panelScript)) { while (PanelStack.Count > 0) { PanelBase tempPanel = PanelStack.Pop(); tempPanel.OnExit(); PanelStack.Peek().OnResume(); if (tempPanel == panelScript) { break; } if (PanelStack.Count <= 0) { Debug.LogError("这是不可能出现的错误,如果出现了那就是代码的问题了"); } } } else { Debug.LogError(panel.ToString() + "面板没有显示,关闭失败"); return; } } else { Debug.LogError(panelGo.name + "面板没有挂载panelBase脚本"); } } else { Debug.LogError("从未实例化过该面板,也没有显示过"); return; } }
/// <summary> 从某个点往中 </summary> private void SomeplaceToSlide(PanelBase go, bool isOpen) { TweenPosition tp = go.gameObject.GetComponent <TweenPosition>(); TweenScale ts = go.gameObject.GetComponent <TweenScale>(); if (tp == null) { tp = go.gameObject.AddComponent <TweenPosition>(); } if (ts == null) { ts = go.gameObject.AddComponent <TweenScale>(); } if (isOpen) { ts.Reset(); tp.Reset(); } tp.from = new Vector3(UnityEngine.Random.Range(0, 1920), UnityEngine.Random.Range(0, 1080)); tp.to = Vector3.zero; ts.from = Vector3.zero; ts.to = Vector3.one; tp.duration = go.OpenDuration; ts.duration = go.OpenDuration; tp.ease = Ease.Linear; ts.ease = Ease.Linear; tp.onFinished = () => { if (isOpen) { go.OnShowed(); } else { DestroyPanel(go.type); } }; go.gameObject.SetActive(true); tp.Play(isOpen); ts.Play(isOpen); }
void OnRuleClick() { PanelBase panel = MainPanelMgr.Instance.ShowDialog("UIRule"); if (null != panel) { XLua.LuaTable tbl = panel.GetEnvTable(); ShowInfo setFunc = null; if (null != tbl) { tbl.Get("ShowInfo", out setFunc); } if (null != setFunc) { setFunc(m_RuleId); } } }
public void OpenPanel(PanelBase parent, UIPanelID id, OpenPanelType forParentType, bool waitAni) { Reset(); panelID = id; SetParentPanel(parent); if (parent == null) { ShowPanel(forParentType); return; } if (waitAni) { parent.AddQuitAniCallBack(() => ShowPanel(forParentType)); } }
private void CreateSaveMixPanel() { _saveMixPanel = AddUIComponent <PanelBase>(); _saveMixPanel.Setup("Save Mix Panel", 350.0f, 0.0f, 5, true, LayoutDirection.Vertical, LayoutStart.TopLeft, "WhiteRect"); _saveMixPanel.color = UIColorGrey; _saveMixPanel.CreateSpace(0.0f, 0.01f); CreateLabel(_saveMixPanel, Translation.Instance.GetTranslation(TranslationID.LABEL_SAVEMIX)); _saveMixPanel.CreateSpace(0.0f, 0.01f); CreateTextField(); _saveMixPanel.CreateSpace(0.0f, 0.01f); if (Application.platform == RuntimePlatform.OSXPlayer) { CreateDisableCompileCheckbox(); _saveMixPanel.CreateSpace(0.0f, 0.01f); } CreateSaveButton(); _saveMixPanel.CreateSpace(0.0f, 5.0f); }
public static PanelBase OpenPanel(Type type) { GameObject uiPrefb = Resources.Load <GameObject>(string.Format("Prefabs/panel/{0}", type.Name));//加载UI预制件 if (!uiPrefb) { Debug.Log("没有找到面板预制件"); return(null); } PanelBase panel = GetPanel(type); if (!panel) { panel = GameObject.Instantiate(uiPrefb).GetComponent <PanelBase>(); panels.Add(type, panel);//type使得每种面板都只能出现一次 } //Debug.Log("打开的面板数:"+ panels.Count); return(panel); }
public void OpenPanel(PanelName panelName) { if (ActivePanel != null) { ActivePanel.gameObject.SetActive(false); } PanelBase Panel = null; if (Panels.TryGetValue(panelName, out Panel) != false) { ActivePanel = Panel; Panel.gameObject.SetActive(true); } else { Debug.LogError("Panel not found."); } }
// <summary> 改变面板的深度 </summary> public void ChangePanelDeth(PanelBase type) { if (panelsDethList.Contains(type)) { if (current == type) { return; } panelsDethList.Remove(type); panelsDethList.Add(type); } else { Debug.LogError("面板不存在"); return; } // LayerMgr.Instance.SetPanelsLayer(panelsDethList); ViewMgr.Instance.SetPanelsLayer(panelsDethList); }
public void ClosePanel(string name) { PanelBase panel = null; if (dict.ContainsKey(name)) { panel = dict[name]; } if (panel == null) { return; } panel.OnClosing(); dict.Remove(name); panel.OnClosed(); Destroy(panel.skin); Destroy(panel); }
/// <summary> 左右往中 </summary> private void LeftAndRightToSlide(PanelBase go, bool isRight, bool isOpen) { TweenPosition tp = go.gameObject.GetComponent <TweenPosition>(); TweenAlpha ta = go.gameObject.GetComponent <TweenAlpha>(); if (tp == null) { tp = go.gameObject.AddComponent <TweenPosition>(); } if (ta == null) { ta = go.gameObject.AddComponent <TweenAlpha>(); } if (isOpen) { ta.Reset(); tp.Reset(); } tp.from = isRight == true ? new Vector3(1000, 0, 0) : new Vector3(-1000, 0, 0); tp.to = Vector3.zero; ta.from = 0; ta.to = 1; ta.duration = go.OpenDuration; tp.duration = go.OpenDuration; tp.ease = Ease.InOutSine; tp.onFinished = () => { if (isOpen) { go.OnShowed(); } else { DestroyPanel(go.type); } }; go.gameObject.SetActive(true); tp.Play(isOpen); ta.Play(isOpen); }
public void OpenPanel <T>(string skinPath, params object[] args) where T : PanelBase //打开面板 { string name = typeof(T).ToString(); Debug.Log(name); if (dict.ContainsKey(name)) { return; } //面板脚本 PanelBase panel = canvas.AddComponent <T>(); panel.Init(args); dict.Add(name, panel); //加载皮肤 skinPath = (skinPath != "" ? skinPath : panel.skinPath); Debug.Log("skinpath/// " + skinPath); GameObject skin = Resources.Load <GameObject>(skinPath); if (skin == null) { Debug.LogError("panelMgr.OpenPanel fail ,skin is null,skinPathj = " + skinPath); } panel.skin = (GameObject)Instantiate(skin); //坐标 Transform skinTrans = panel.skin.transform; PanelLayer layer = panel.layer; Transform parent = layerDict[layer]; skinTrans.SetParent(parent, false); panel.OnShowing(); panel.OnShowed(); }
private void CreateDetailPanel() { DetailPanel = _panelRight.AddUIComponent <PanelBase>(); DetailPanel.Setup("Terrain Detail Panel", 350.0f, 231.0f, 5, bgSprite: "WhiteRect"); DetailPanelInner = DetailPanel.AddUIComponent <PanelBase>(); DetailPanelInner.Setup("Terrain Detail Panel Inside", 1.0f, 1.0f, 5, true, LayoutDirection.Vertical); DetailPanelInner.anchor = UIAnchorStyle.CenterHorizontal | UIAnchorStyle.CenterVertical; UILabel label = DetailPanelInner.AddUIComponent <UILabel>(); label.font = UIUtils.Font; label.textScale = 1.0f; label.padding = new RectOffset(4, 0, 4, 0); label.relativePosition = Vector2.zero; label.text = Translation.Instance.GetTranslation(TranslationID.LABEL_TITLE_DETAIL); GrassDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>(); bool grassState = Controller.GetValue <bool>(ValueID.GrassDetailEnabled); string grassLabelText = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_GRASSDETAIL); string grassTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_GRASSDETAIL); GrassDetail.Initialize(grassState, grassLabelText, grassTooltipText); GrassDetail.EventCheckboxStateChanged += OnDetailStateChanged; FertileDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>(); bool fertileState = Controller.GetValue <bool>(ValueID.FertileDetailEnabled); string fertileLabelText = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_FERTILEDETAIL); string fertileTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_FERTILEDETAIL); FertileDetail.Initialize(fertileState, fertileLabelText, fertileTooltipText); FertileDetail.EventCheckboxStateChanged += OnDetailStateChanged; CliffDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>(); bool cliffState = Controller.GetValue <bool>(ValueID.RocksDetailEnabled); string cliffLabelText = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_CLIFFDETAIL); string cliffTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_CLIFFDETAIL); CliffDetail.Initialize(cliffState, cliffLabelText, cliffTooltipText); CliffDetail.EventCheckboxStateChanged += OnDetailStateChanged; DetailPanelInner.autoFitChildrenHorizontally = true; }
public bool IsTopPanel(PanelBase targetPanel) { bool result = true; int targetDepth = targetPanel.gameObject.GetComponent <UIPanel> ().depth; if (_panels.Count > 0) { foreach (PanelBase panelbase in _panels.Values) { int sourceDepth = panelbase.gameObject.GetComponent <UIPanel> ().depth; if (sourceDepth > targetDepth) { result = false; } } } return(result); }
/// <summary> /// 获取当前显示的最顶层UI。 /// </summary> /// <param name="topbar">是否包含TopBar</param> /// <returns>UI对象。</returns> public PanelBase GetTopUI(bool topbar = false) { PanelBase ret = null; var e = panelDic.GetEnumerator(); while (e.MoveNext()) { PanelBase panel = e.Current.Value; if (panel.IsShown && ((topbar && panel.PanelName == "CommonTopBar") || !panel.mCfg.ignoreguide)) { if (ret == null || ret.Canvas.sortingOrder < panel.Canvas.sortingOrder) { ret = panel; } } } e.Dispose(); return(ret); }
public void HideAllPanel(bool disable) { List <PanelBase> allPanels = new List <PanelBase>(); foreach (KeyValuePair <string, PanelBase> data in panelDic) { PanelBase panel = data.Value; allPanels.Add(panel); } for (int i = 0; i < allPanels.Count; i++) { PanelBase panel = allPanels[i]; if (null != panel) { panel.Hide(); } } mCurPanelName = ""; CheckMaxCache(); }
public void Next() { PanelBase currentPanel = panels[currentIndex]; var nextPanel = panels[currentIndex + 1] as PanelBase; if (currentPanel is ConfirmPanel && !confirmPanel1.IsInstallFinishsd) { ifinstall = true; previousButton.Enabled = nextButton.Enabled = cancelButton.Enabled = false; confirmPanel1.Install(); } else { currentPanel.Visible = false; nextPanel.Visible = true; currentIndex++; panels[currentIndex].OnShown(false); ApplyPanelProperty(panels[currentIndex]); } }
void OnTaskFinish(GameEvent ge, EventParameter parameter) { TaskMgr.TaskEnum type = (TaskMgr.TaskEnum)parameter.intParameter; if (type == TaskMgr.TaskEnum.finish) // 任务完成 { if (finishTaskEffectObj == null) { finishTaskEffectObj = CoreEntry.gGameObjPoolMgr.Instantiate("Effect/ui/uf_wanchengrenwu"); PanelBase parentBase = CoreEntry.gMainPanelMgr.GetPanel("UIMain"); if (parentBase != null) { finishTaskEffectObj.transform.SetParent(parentBase.gameObject.transform); finishTaskEffectObj.transform.localPosition = new Vector3(0, 200, 0); finishTaskEffectObj.transform.localScale = Vector3.one; } } finishTaskEffectObj.SetActive(true); Invoke("HideTaskEffect", 1.5f); } }
private void CreateLabels() { _labelsPanel = AddUIComponent <PanelBase>(); _labelsPanel.Setup("Labels Panel", 255.0f, 64.0f, 0, true, LayoutDirection.Vertical); _labelsPanel.autoFitChildrenHorizontally = true; _nameLabel = _labelsPanel.AddUIComponent <UILabel>(); _nameLabel.autoSize = false; _nameLabel.size = new Vector2(width, 33.0f); _nameLabel.padding = new RectOffset(5, 0, 8, 0); _nameLabel.textScale = 1.0f; _nameLabel.font = UIUtils.BoldFont; _authorLabel = _labelsPanel.AddUIComponent <UILabel>(); _authorLabel.autoSize = false; _authorLabel.size = new Vector2(width, 33.0f); _authorLabel.padding = new RectOffset(5, 0, 2, 0); _authorLabel.textScale = 0.8f; _authorLabel.font = UIUtils.BoldFont; }
private void RefreshSwatchesPanel() { if (swatchesPanel != null) { Destroy(swatchesPanel.gameObject); } swatchesPanel = AddUIComponent <PanelBase>(); swatchesPanel.zOrder = 0; swatchesPanel.Build(PanelType.None, new Layout(new Vector2(0.0f, 28.0f), false, LayoutDirection.Horizontal, LayoutStart.TopLeft, 5)); swatchesPanel.autoFitChildrenHorizontally = false; swatchesPanel.autoLayout = true; swatchesPanel.width = 256.0f; swatchesPanel.wrapLayout = true; swatchesPanel.autoFitChildrenVertically = true; swatchesPanel.padding = new RectOffset(10, 0, 10, 0); foreach (var swatch in NetworkSkinPanelController.Color.Swatches) { AddSwatch(swatch); } }
//关闭面板 public void ClosePanel(string name) { PanelBase panel = (PanelBase)dict[name]; if (panel == null) { return; } panel.OnClosing(); dict.Remove(name); Tweener tweener = panel.skin.transform.DOLocalMoveX(1300, 2f); tweener.SetEase(Ease.OutBack); tweener.OnComplete(() => { panel.OnClosing(); GameObject.Destroy(panel.skin); Component.Destroy(panel); }); }
public PanelBase ShowDialog(string panelName, bool hasEffect = true, int depth = 0) { if (!HasPanel(panelName)) { LogMgr.UnityLog("has not pannel:" + panelName); return(null); } if (m_showTimesMap.ContainsKey(panelName)) { m_showTimesMap[panelName] += 1; } else { m_showTimesMap.Add(panelName, 1); } PanelBase dialog = GetPanel(panelName); //dialog.PanelMgr = this; mShowDlgList.Add(dialog); if (dialog != null) { //已经显示出来的UI不再播动画 if (!dialog.IsShown) { MainPanelUICfg cfg; if (mPrefabMap.TryGetValue(panelName, out cfg)) { if (cfg.AnimationType == 1) { UIAnimationMgr.Instance.PlayAnimation(dialog.gameObject, dialog.AnimationDialogCallBack); } } } dialog.Show(); } return(dialog); }
public void Show(bool effect) { IsHiding = false; if (!effect) { gameObject.SetActive(true); } else { UITweenAnimation tweenAnimation = gameObject.GetComponent <UITweenAnimation>(); gameObject.SetActive(false); if (tweenAnimation != null && !IsShowing && isSuportEffect) { Scheduler.Create(this, (sche, t, s) => { PanelBase panelBase = sche.owner as PanelBase; if (panelBase != null && !panelBase.IsHiding) { if (panelBase.gameObject != null) { panelBase.gameObject.SetActive(true); UITweenAnimation tween = panelBase.gameObject.GetComponent <UITweenAnimation>(); if (tween != null) { IsShowing = true; tween.OnShow(true, () => { IsShowing = false; }); } } } }, 0, 0, 0.01f); } else { gameObject.SetActive(true); } } }
public void GE_PLAYER_LV(GameEvent ge, EventParameter param) { int oldLevel = param.intParameter; int level = PlayerData.Instance.BaseAttr.Level; List <int> skillLockLevel = GetSkillLockLevel(); int skillIndex = -1; for (int i = 0; i < skillLockLevel.Count; i++) { if (skillLockLevel[i] <= level && skillLockLevel[i] > oldLevel) { skillIndex = i; break; } } if (skillIndex == -1) { return; } CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SHOW_BATTER, null); PanelBase panel = MainPanelMgr.Instance.ShowDialog("UISkillOpenTips"); XLua.LuaTable tbl = panel.GetEnvTable(); ShowInfo setFunc = null; if (null != tbl) { tbl.Get("ShowInfo", out setFunc); } if (null != setFunc) { setFunc(skillIndex); } Invoke("DelayReBindLock", delayTime); //Debug.LogError("skillIndex"); }
/// <summary> /// Show Panel /// </summary> /// <param name="sceneType"></param> /// <param name="sceneArgs"></param> public void ShowPanel(PanelName panelName, params object[] sceneArgs) { if (panels.ContainsKey(panelName)){ Debug.LogError("Panel has been shown"); current = panels[panelName]; current.gameObject.SetActive(false); current.OnInit(sceneArgs); current.OnShowing(); LayerMgr.GetInstance().SetLayer(current.gameObject, LayerType.Panel); } else{ GameObject go = new GameObject(panelName.ToString()); //sceneType.tostring = classname in the current scene current = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(go, "Assets/Script/Core/View/PanelMgr.cs (94,14)", panelName.ToString()) as PanelBase; current.gameObject.SetActive(false); current.OnInit(sceneArgs); panels.Add(current.type, current); current.OnShowing(); LayerMgr.GetInstance().SetLayer(current.gameObject, LayerType.Panel); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.identity; MaskStyle(current); } StartShowPanel(current, current.PanelShowStyle,true); }
void MaskStyle(PanelBase go) { float alpha = 1; switch(go.PanelMaskStyle){ case PanelMaskStyle.Alpha: alpha = 0.001f; break; case PanelMaskStyle.BlackAlpha: alpha = 0.5f; break; } GameObject mask = ResourceMgr.GetInstance().CreateGameObject("Public/prefab/PanelMask", true); mask.transform.parent = go.gameObject.transform; mask.transform.localPosition = Vector3.zero; mask.transform.localEulerAngles = Vector3.zero; mask.transform.localScale = Vector3.one; UIPanel panel = mask.GetComponent<UIPanel>(); panel.alpha = alpha; LayerMgr.GetInstance().SetLayer(go.gameObject, LayerType.Panel); }
/// <summary> Default </summary> void ShowNomal(PanelBase go, bool isOpen) { if (isOpen) { current.gameObject.SetActive(true); current.OnShowed(); } else DestroyPanel(go.type); }
/// <summary> </summary> private void StartShowPanel(PanelBase go, PanelShowStyle showStyle, bool isOpen) { switch(showStyle) { case PanelShowStyle.Nomal: ShowNomal(go, isOpen); break; case PanelShowStyle.CenterScaleBigNomal: CenterScaleBigNomal(go, isOpen); break; case PanelShowStyle.LeftToSlide: LeftAndRightToSlide(go, false, isOpen); break; case PanelShowStyle.RightToSlide: LeftAndRightToSlide(go, true, isOpen); break; case PanelShowStyle.UpToSlide: TopAndDownToSlide(go, true, isOpen); break; case PanelShowStyle.DownToSlide: TopAndDownToSlide(go, false, isOpen); break; } }
/// <summary> /// 上下往中 /// </summary> /// <param name="go"></param> /// <param name="isOpen"></param> /// <param name="isTop"></param> private void ShowTopScale(PanelBase go, bool isOpen, bool isTop) { TweenPosition tp = go.gameObject.GetComponent<TweenPosition>(); if (tp == null) tp = go.gameObject.AddComponent<TweenPosition>(); tp.from = isTop ? new Vector3(0, 600, 0) : new Vector3(0, -600, 0); tp.to = Vector3.zero; tp.duration = go.openDuration; tp.SetOnFinished(() => { if (!isOpen) DestroyPanel(go.type); }); go.gameObject.SetActive(true); if (!isOpen) tp.Play(isOpen); }
/// <summary> /// 中间变大 /// </summary> void ShowCenterScaleBigNormal(PanelBase go, bool isOpen) { TweenScale ts = go.gameObject.GetComponent<TweenScale>(); if (ts == null) { ts = go.gameObject.AddComponent<TweenScale>(); } ts.from = Vector3.zero; ts.to = Vector3.one; ts.duration = go.openDuration; ts.SetOnFinished(() => { if (!isOpen) DestroyPanel(go.type); }); go.gameObject.SetActive(true); if (!isOpen) ts.Play(isOpen); }
void ShowNormal(PanelBase go,bool isOpen) { if (!isOpen) { DestroyPanel(go.type); } else { go.gameObject.SetActive(true); } }
private void StartShowPanel(PanelBase go, PanelMgr.PanelShowStyle showStyle, bool isOpen) { switch (showStyle) { case PanelShowStyle.Normal: ShowNormal(go, isOpen); break; case PanelShowStyle.CenterScaleBigNormal: ShowCenterScaleBigNormal(go, isOpen); break; case PanelShowStyle.LeftToSlide: ShowLeftScale(go, isOpen,true); break; case PanelShowStyle.RightToSlide: ShowLeftScale(go, isOpen, false); break; case PanelShowStyle.TopToSlide: ShowTopScale(go, isOpen, true); break; case PanelShowStyle.DownToSlide: ShowTopScale(go, isOpen, false); break; } }
/// <summary> opAndDownToSlide </summary> void TopAndDownToSlide(PanelBase go, bool isTop,bool isOpen) { TweenPosition tp = go.gameObject.GetComponent<TweenPosition>(); if (tp == null) tp = go.gameObject.AddComponent<TweenPosition>(); // tp.from = isTop == true ? new Vector3(0, 640, 0) : new Vector3(0, -640, 0); tp.to = Vector3.zero; tp.duration = go.OpenDuration; tp.method = UITweener.Method.EaseInOut; tp.SetOnFinished(() => { if (isOpen) go.OnShowed(); else DestroyPanel(go.type); }); go.gameObject.SetActive(true); if (!isOpen) tp.Play(isOpen); }
public Contour(PanelBase panelBase) { this.panelBase = panelBase; }
/// <summary> CenterScaleBig </summary> void CenterScaleBigNomal(PanelBase go, bool isOpen) { TweenScale ts = go.gameObject.GetComponent<TweenScale>(); if (ts == null)ts = go.gameObject.AddComponent<TweenScale>(); // ts.from = Vector3.zero; ts.to = Vector3.one; ts.duration = go.OpenDuration; ts.method = UITweener.Method.EaseInOut; ts.SetOnFinished(() => { if(isOpen) go.OnShowed(); else DestroyPanel(go.type); }); go.gameObject.SetActive(true); if (!isOpen) ts.Play(isOpen); }