public void Updata() { KeyCode nEscapeKeyCode = FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.SystemPannel); //不要ESC界面的时候这里也记得关掉 if ((!BindKeyCodeForMovieTable.ContainsKey(nEscapeKeyCode)) && PopupMovieStack.Count > 0) { PopMovie(); } foreach (DictionaryEntry keypair in BindKeyCodeForMovieTable) { KeyCode key = (KeyCode)keypair.Key; SFMovieEx movie = (SFMovieEx)keypair.Value; if (InputManager.GetKeyUp(key)) { if (key == nEscapeKeyCode && PopupMovieStack.Count > 0) { PopMovie(); continue; } if (!IsMovieAllowed(movie)) { PushMovie(movie); } else { PopMovie(movie); } } } }
private void onEnter(ESummonerState nState) { switch (nState) { case ESummonerState.ESS_TalentPage: { CurSummonerFrame = TalentPage; if (SFGFxMovieManager.CheckTheMovieCanUse(TalentPage)) { TalentPage.EnterMovie(); // ShowSummonerFrame(true); } } break; default: { break; } } if (CurSummonerFrame != null) { CurSummonerFrame.SetDepth((int)SFGFxMovieManager.EGFxMovieLayer.EGFxLayer_PopupLayer + 1); } }
/// <summary> /// 判断PopupMovieStack里是否已经有_targetMovie /// </summary> /// <param name="_targetMovie">要检测的movie</param> /// <returns></returns> private bool IsMovieAllowed(SFMovieEx _targetMovie) { if (PopupMovieStack.Contains(_targetMovie)) { return(true); } return(false); }
/// <summary> /// 按键与界面绑定,一个按键只与一个movie绑定(应该很正常吧?)界面移除的时候,绑定也会移除 /// </summary> /// <param name="_targetKeyCode">要绑定的目标按键</param> /// <param name="_targetMovie">按键绑定的movie</param> public void BindKeyCodeForMovie(KeyCode _targetKeyCode, SFMovieEx _targetMovie) { if (BindKeyCodeForMovieTable.ContainsKey(_targetKeyCode)) { Trace.LogWarning("KeyCode:" + _targetKeyCode + "is bind a movie,use other"); return; } BindKeyCodeForMovieTable.Add(_targetKeyCode, _targetMovie); }
private void onExit(EHallWinState nState) { switch (nState) { case EHallWinState.EHWS_None: break; case EHallWinState.EHWS_Hall: { if (SFGFxMovieManager.CheckTheMovieCanUse(HallWin)) { HallWin.LeaveMovie(); } } break; case EHallWinState.EHWS_Waiting: { if (SFGFxMovieManager.CheckTheMovieCanUse(WaitingRoomWin)) { WaitingRoomWin.LeaveMovie(); } } break; case EHallWinState.EHWS_Creating: { if (SFGFxMovieManager.CheckTheMovieCanUse(CreatingRoomWin)) { CreatingRoomWin.LeaveMovie(); } } break; case EHallWinState.EHWS_Summoner: { CurHallWin = SummonerFrame; if (SFGFxMovieManager.CheckTheMovieCanUse(SummonerFrame)) { SummonerFrame.LeaveMovie(); } } break; } }
/// <summary> /// 解除按键与movie的绑定信息 /// </summary> /// <param name="_targetMovie"></param> public void UnBindKeyCodeForMovie(SFMovieEx _targetMovie) { if (!BindKeyCodeForMovieTable.ContainsValue(_targetMovie)) { return; } KeyCode code = KeyCode.None; foreach (DictionaryEntry keypair in BindKeyCodeForMovieTable) { if ((keypair.Value as SFMovieEx) == _targetMovie) { BindKeyCodeForMovieTable.Remove(keypair.Key); break; } } }
/// <summary> /// 检测传来的Movie是否不为空且是否已经注册好SF的变量 /// </summary> /// <param name="_movie">要检测的Movie</param> /// <returns>true:Movie可用;false:Movie暂不可用</returns> public static bool CheckTheMovieCanUse(Movie _movie) { bool res = false; SFMovieEx tmpMovie = _movie as SFMovieEx; if (tmpMovie == null) { return(res); } res = tmpMovie.IsRegisterMovieSuccess ? true : false; if (!res) { Trace.LogWarning("这里有个消息不能调用界面功能,请修改!\n" + System.Environment.StackTrace); } return(res); }
public void InsertMovie(SFMovieEx _insertSource, SFMovieEx _insertTarget) { if (IsMovieAllowed(_insertTarget)) { int sourceIndex = PopupMovieStack.IndexOf(_insertSource); int targetIndex = PopupMovieStack.IndexOf(_insertTarget); int tmpDepth = _insertSource.Depth; _insertSource.SetDepth(_insertTarget.Depth); _insertTarget.SetDepth(tmpDepth); PopupMovieStack[sourceIndex] = _insertTarget; PopupMovieStack[targetIndex] = _insertSource; } else { PushMovie(_insertTarget); } }
public void PushMovie(SFMovieEx _targetMovie) { if (_targetMovie == null) { return; } if (!IsMovieAllowed(_targetMovie)) { _targetMovie.EnterMovie(); PopupMovieStack.Add(_targetMovie); } int nNewDepth = (int)(SFGFxMovieManager.EGFxMovieLayer.EGFxLayer_PopupLayer) + PopupMovieStack.Count + 1; if (_targetMovie.Depth != nNewDepth) { _targetMovie.SetDepth(nNewDepth); } }
/// <summary> /// 移除movie /// </summary> /// <param name="_targetMovie">指定要移除的mv,如果为null则移除栈顶的mv</param> /// <returns>返回当前要移出栈的mv</returns> public SFMovieEx PopMovie(SFMovieEx _targetMovie = null) { if (PopupMovieStack.Count < 0) { return(null); } SFMovieEx popMV = null; if (_targetMovie == null) { popMV = PopupMovieStack[PopupMovieStack.Count - 1]; } else { if (!PopupMovieStack.Contains(_targetMovie)) { return(null); } int nTargetIndex = PopupMovieStack.IndexOf(_targetMovie); popMV = PopupMovieStack[nTargetIndex]; } if (popMV == null) { return(null); } popMV.LeaveMovie(); int nNewDepth = (int)(SFGFxMovieManager.EGFxMovieLayer.EGFxLayer_Default); if (popMV.Depth != nNewDepth) { popMV.SetDepth(nNewDepth); } PopupMovieStack.Remove(popMV); return(popMV); }
/// <summary> /// 创建一个Window /// </summary> /// <typeparam name="T">创建的是那个类</typeparam> /// <param name="_name">swf名字,用于区分各个不同的swf</param> /// <param name="_fullPatch">全路径,相对于streamingasset文件夹</param> /// <param name="_backgroundColor">背景颜色(255为单位)</param> /// <param name="_bVisibleOnCreate">是否创建的时候在画布上显示出来</param> /// <param name="_bIgnoreMovie">是否加入忽略列表,目前用于按esc隐藏界面功能</param> /// <param name="_modeType">movie的缩放方式</param> /// <param name="_fromByteStream">从字节流中创建</param> /// <param name="_renderTexture">是否使用Rt</param> /// <param name="_scaleModeType">缩放模式</param> /// <param name="_movieName">电影名称,暂时忽略</param> /// <returns></returns> public T CreateWindow <T>(string _name, string _fullPatch, Color32 _backgroundColor, bool _bVisibleOnCreate = false, ScaleModeType _modeType = ScaleModeType.SM_ShowAll, bool _fromByteStream = true, RenderTexture _renderTexture = null, string _movieName = null) where T : Movie { if (GetWindow(_name) != null) { return(GetWindow(_name) as T); } T newMovie = default(T); newMovie = GfxUtil.CreateSwf <T>(this, _fullPatch, _fromByteStream, _backgroundColor, _renderTexture, _modeType, _movieName); if (null == newMovie) { return(null); } SFMovieEx MovieEx = newMovie as SFMovieEx; MovieEx.IsVisibleOnCreate = _bVisibleOnCreate; windowRegistryList.Add(_name, newMovie); return(newMovie); }
private void onEnter(EHallWinState nState) { switch (nState) { case EHallWinState.EHWS_None: { if (CurHallWin != null) { CurHallWin.SetMovieVisible(false); if (CurHallWin == WaitingRoomWin) { ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_MATCH_ROOM_PLAYER_EXIT); } else { ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_MATCH_EXIT_HALL); } UISystem.Instance.ShowWnd(WndID.WND_ID_PLAYERBUTTONFRAME, true); CurHallWin = null; } } break; case EHallWinState.EHWS_Hall: { CurHallWin = HallWin; if (SFGFxMovieManager.CheckTheMovieCanUse(HallWin)) { HallWin.EnterMovie(); } } break; case EHallWinState.EHWS_Waiting: { CurHallWin = WaitingRoomWin; if (SFGFxMovieManager.CheckTheMovieCanUse(WaitingRoomWin)) { WaitingRoomWin.EnterMovie(); } } break; case EHallWinState.EHWS_Creating: { CurHallWin = CreatingRoomWin; if (SFGFxMovieManager.CheckTheMovieCanUse(CreatingRoomWin)) { CreatingRoomWin.EnterMovie(); } } break; case EHallWinState.EHWS_HighLadder: { CurHallWin = HighLadder; if (SFGFxMovieManager.CheckTheMovieCanUse(HighLadder)) { HighLadder.EnterMovie(); } } break; case EHallWinState.EHWS_Summoner: { CurHallWin = SummonerFrame; if (SFGFxMovieManager.CheckTheMovieCanUse(SummonerFrame)) { SummonerFrame.EnterMovie(); } } break; default: { break; } } if (CurHallWin != null) { CurHallWin.SetDepth((int)SFGFxMovieManager.EGFxMovieLayer.EGFxLayer_PopupLayer); } }