public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (SceneId != 0) { hash ^= SceneId.GetHashCode(); } if (PubState != 0) { hash ^= PubState.GetHashCode(); } hash ^= selectIds_.GetHashCode(); if (CreateTime != 0L) { hash ^= CreateTime.GetHashCode(); } if (PubTime != 0L) { hash ^= PubTime.GetHashCode(); } if (TipState != 0) { hash ^= TipState.GetHashCode(); } return(hash); }
public void DetermineLevelToLoad() { switch (IOSystem.Instance.data.LevelsCompleted) { case (0x000000002): { sceneToLoad = SceneId.Spring; break; } case (0x000000004): { sceneToLoad = SceneId.Summer; break; } case (0x000000008): { sceneToLoad = SceneId.Fall; break; } case (0x00000000c): { sceneToLoad = SceneId.Winter; break; } } }
public void SwitchToScene(SceneId sceneId, object param = null) { if (sceneId == CurrentSceneId) { LogModule.WarningLog("switch to current scene: " + sceneId); } LogModule.DebugLog("SceneMgr SwitchToScene sceneId:" + sceneId.ToString() + " " + System.DateTime.Now.ToString()); mParam = param; if (mCurScene != null) { mCurScene.OnWillExit(); //App.EventMgr.Post(EventId.SceneWillExit, mCurScene.Id); } if (mSceneTypeDict.ContainsKey(sceneId)) { mNextScene = Activator.CreateInstance(mSceneTypeDict[sceneId]) as SceneBase; if (mNextScene != null) { mNextScene.OnWillEnter(param); } } if (hdlSceneWillSwitch != null) { hdlSceneWillSwitch.Invoke(mCurrentSceneId, sceneId, param); } SceneManager.LoadScene(sceneId.ToString()); }
void Set(SceneId activatingSceneId) { foreach (var sceneId in _scenes.Keys.ToList()) { var sceneExchange = GetExchange(sceneId); var scene = _scenes[sceneId]; if (activatingSceneId == sceneId) { var interfaces = scene.GetType().GetInterfaces(); var sceneInterface = interfaces.FirstOrDefault(x => typeof(IScene).IsAssignableFrom(x) && x != typeof(IScene)); if (sceneInterface != null) { Exchange.Register(sceneInterface, scene); } else { Exchange.Attach(scene); } sceneExchange.IsActive = true; } else { scene.Detach(); sceneExchange.IsActive = false; } } ActiveSceneId = activatingSceneId; }
public static EnterGameEventArgs Create(SceneId level) { EnterGameEventArgs e = new EnterGameEventArgs(); e.Level = level; return(e); }
protected override void OnOpen(object userData) { base.OnOpen(userData); for (int i = 0; i < m_LevelItems.Length; i++) { int levelId = m_LevelItems[i].LevelId; string levelName = m_LevelItems[i].LevelName; SceneId sceneId = m_LevelItems[i].SceneId; LevelItem item = m_LevelItems[i]; item.onClick.Add(() => { m_CurSelectLevelId = levelId; m_LevelScene = sceneId; m_SelectText.text = levelName; m_EnterButton.enabled = !item.IsLock; }); } m_EnterButton?.onClick.Add(() => { EnterLevelEventArgs eventArgs = ReferencePool.Acquire <EnterLevelEventArgs>(); eventArgs.Fill(m_CurSelectLevelId, m_LevelScene); GameEntry.Event.Fire(this, eventArgs); GameEntry.UI.CloseUIForm(UIFormId.LevelSelectForm); }); m_CloseButton?.onClick.Add(() => { GameEntry.UI.CloseUIForm(UIFormId.LevelSelectForm); }); }
public void AddPlat() { if (++_iPlatIndex > BattleManager.GetInst().Stairs) { return; } BattleFieldData field = BattleManager.GetInst().GetFieldData(_iPlatIndex); BattlePlat plat = ResourceMgr.PopBox(SceneId, field.Type); plat.Index = _iPlatIndex; plat.X = field.X; plat.Y = field.Y; plat.m_Transform.SetParent(ForegroundTran); plat.m_Transform.localPosition = new Vector3(field.X, field.Y, 0f); plat.m_Transform.localScale = Vector3.one; if (field.Item > 0) { string itemId = ConfigData.GetValue("Scene_Common", SceneId.ToString(), string.Format("Item{0}", field.Item)); if (itemId != "-1") { int id = int.Parse(itemId); BattleItem item = ResourceMgr.PopItem(id); item.Type = id; item.m_Transform.SetParent(plat.m_Transform, false); } } _dicPlat.Add(_iPlatIndex, plat); }
public void SwitchToLevel(SceneId sceneId, Action <float> loadCallback = null) { if (sceneId == _cur_scene_id) { Debug.LogError("已经在该场景 " + sceneId.ToString()); } _cur_scene_id = sceneId; AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneId.ToString()); load_timer_id = TimerManager.Instance().RepeatCallFunc(delegate(float dt) { if (asyncLoad.isDone) { TimerManager.Instance().DestroyTimer(load_timer_id); load_timer_id = -1; if (loadCallback != null) { loadCallback.Invoke(100f); } } else { if (loadCallback != null) { loadCallback.Invoke(asyncLoad.progress); } } }, 0.01f); }
void Set(SetSceneEvent e) { _scenes[ActiveSceneId].IsActive = false; foreach (var sceneId in _scenes.Keys) { var scene = _scenes[sceneId]; scene.IsActive = sceneId == e.SceneId; if (!scene.IsActive) { continue; } Exchange.Attach(scene); var interfaces = scene.GetType().GetInterfaces(); var sceneInterface = interfaces.FirstOrDefault(x => typeof(IScene).IsAssignableFrom(x) && x != typeof(IScene)); if (sceneInterface != null) { Exchange.Register(sceneInterface, scene); } } ActiveSceneId = e.SceneId; }
protected override void OnInit(object userData) { base.OnInit(userData); m_LeveList = UI.GetChild("list_Level").asList; m_SelectText = UI.GetChild("tf_Select").asTextField; m_EnterButton = UI.GetChild("btn_Enter").asButton; m_CloseButton = UI.GetChild("n1").asCom.GetChild("btn_Close").asButton; m_LeveList.RemoveChildrenToPool(); DRLevel[] drLevels = GameEntry.DataTable.GetDataTable <DRLevel>().GetAllDataRows(); m_LevelItems = new LevelItem[drLevels.Length]; for (int i = 0; i < drLevels.Length; i++) { LevelItem item = m_LeveList.AddItemFromPool() as LevelItem; if (item == null) { Log.Error("levelItem is null."); break; } item.Init(drLevels[i]); m_LevelItems[i] = item; } //默认选中第一个 m_CurSelectLevelId = m_LevelItems[0].LevelId; m_LevelScene = m_LevelItems[0].SceneId; }
public override int GetHashCode() { int hash = 1; if (SceneId.Length != 0) { hash ^= SceneId.GetHashCode(); } if (PortalId.Length != 0) { hash ^= PortalId.GetHashCode(); } if (ObjectPlacementId.Length != 0) { hash ^= ObjectPlacementId.GetHashCode(); } if (PortalPlacementId.Length != 0) { hash ^= PortalPlacementId.GetHashCode(); } if (PortkeyAsset.Length != 0) { hash ^= PortkeyAsset.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
void RegisterScene(SceneId sceneId, Type sceneType) { if (!mSceneTypeDict.ContainsKey(sceneId)) { mSceneTypeDict.Add(sceneId, sceneType); } }
private void LoadScene(SceneId sceneId) { UnloadAll(); var childScene = _contentManager.Load <Scene>(_sceneUrls[sceneId]); _initScene.Children.Add(childScene); }
public static bool InSecene(SceneId sceneId) { IDataTable <DRScene> dtScene = GameEntry.DataTable.GetDataTable <DRScene>(); DRScene drScene = dtScene.GetDataRow((int)sceneId); string sceneAssetName = AssetUtility.GetSceneAsset(drScene.AssetName); return(GameEntry.Scene.SceneIsLoaded(sceneAssetName)); }
static int IntToEnum(IntPtr L) { int arg0 = (int)LuaDLL.lua_tonumber(L, 1); SceneId o = (SceneId)arg0; ToLua.Push(L, o); return(1); }
public EventExchange GetExchange(SceneId id) { if (!_exchanges.ContainsKey(id)) { _exchanges[id] = new EventExchange($"Scene:{id}", Exchange); } return(_exchanges[id]); }
void EnterGameHandler(object sender, GameEventArgs e) { EnterGameEventArgs ne = (EnterGameEventArgs)e; if (ne != null) { targetScene = ne.Level; } }
public virtual void Init(SceneId sceneId) { this.sceneId = sceneId; this.panels = new Dictionary <PanelId, UIPage>(); ///添加对应的UIPackage ///你需要在这里初始化所有的UIPage Setting }
public void ChangeScene(SceneId newSceneId) { CurrentScene.Unload(); var newScene = GetScene(newSceneId); Game.ResourceHandler.UnloadAndLoad(CurrentScene.BitmapSet, newScene.BitmapSet); newScene.Load(); CurrentScene = newScene; }
/// <summary> /// Constructs a Flag Lifetime with a starting and ending Scene ID. /// </summary> /// <param name="startSceneId">The Scene ID where the flag first appears.</param> /// <param name="endSceneId">The Scene ID that wipes the flag or changes its usage.</param> /// /// <exception cref="ArgumentException"> /// <paramref name="startSceneId"/> is greater than <paramref name="endSceneId"/>. /// </exception> public FlagLifetime(SceneId startSceneId, SceneId endSceneId) { if (startSceneId > endSceneId) { throw new ArgumentException($"{nameof(startSceneId)} cannot be greater than {nameof(endSceneId)}, " + $"got {startSceneId} and {endSceneId}!"); } StartSceneId = startSceneId; EndSceneId = endSceneId; }
public override int GetHashCode() { int hash = 1; if (SceneId != 0) { hash ^= SceneId.GetHashCode(); } if (TalkId != 0) { hash ^= TalkId.GetHashCode(); } if (SceneName.Length != 0) { hash ^= SceneName.GetHashCode(); } if (HeadId != 0) { hash ^= HeadId.GetHashCode(); } if (PicId != 0) { hash ^= PicId.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Blogger.Length != 0) { hash ^= Blogger.GetHashCode(); } if (BtnTxt.Length != 0) { hash ^= BtnTxt.GetHashCode(); } if (Content.Length != 0) { hash ^= Content.GetHashCode(); } if (Reading != 0) { hash ^= Reading.GetHashCode(); } if (Comments != 0) { hash ^= Comments.GetHashCode(); } if (Likes != 0) { hash ^= Likes.GetHashCode(); } hash ^= selectIds_.GetHashCode(); return(hash); }
private Scene GetScene(SceneId scene) { switch (scene) { case SceneId.Test: return(new TestScene()); default: throw new Util.OhNoException("um that's not a valid scene ID"); } }
public void SwitchingScene(SceneId senceId) { if (current != null && senceId == current.sceneId) { Debug.Log(" 试图切换场景至当前场景:" + current.sceneId.ToString()); return; } HideCurrentScene(); ShowScene(senceId, scenes[senceId]); }
protected internal override void OnUpdate(IFsm <ProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds) { base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); //Log.Debug("procedure preload update " + elapseSeconds + " " + realElapseSeconds); if (targetScene != SceneId.None) { GameEntry.Scene.LoadScene(targetScene); ChangeState <ProcedureGame>(procedureOwner); targetScene = SceneId.None; } }
static void Main(string[] args) { Console.WriteLine(int.TryParse(null, out _)); Console.WriteLine($"{23424323:N} {12341231221:D}"); Console.WriteLine($"{Convert.ToString(14, 2).PadLeft(4, '0')}"); SceneId sid = 0x30F; Console.WriteLine(new Password("BBBBYYYQ").Corrected()); Console.WriteLine(new Password("ZZZZZYYY").ToString("PC")); Password.TryParse("ZZZZZYYY", out var pw); Console.WriteLine(pw); Console.WriteLine(pw.ToString("PC")); sid = "AZE"; Console.WriteLine(sid.String); Console.WriteLine(sid.Value); Console.WriteLine(new PasswordSceneId(sid).Randomized()); Console.ReadLine(); TestParse("15", s => Letter.Parse(s)); TestParse($"{0x3FF}", s => SceneId.Parse(s), "V"); TestParse($"0x3FF", s => SceneId.Parse(s, PasswordStyles.Any), "V"); TestParse($"0b0011 0000 0010", s => SceneId.Parse(s, PasswordStyles.Any), "PB1"); TestParse($"0b1101 0011 0000 0100", s => PasswordFlagData.Parse(s, PasswordStyles.Any), "PB1"); while (true) { try { Console.Write("> "); Password p = new Password(Console.ReadLine()); Console.WriteLine($" Password: {p}"); //Password.TryParse(Console.ReadLine(), out p); //Console.WriteLine($" Password: {p}"); Console.WriteLine($" Normalized: {p:PN}"); Console.WriteLine($" Randomized: {p:PR}"); Console.WriteLine($"Hexidecimal: {p:PX}"); //Console.WriteLine($"Scene: {p.Scene.Value.ToString().PadLeft(4)}, Flags: {p.Flags:B1} ({p.Flags:X})"); Console.WriteLine($"Scene: {p.Scene,4:V}, Flags: {p.Flags:PB1} ({p.Flags:PX}) ({p.Flags:PD})"); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex); Console.ResetColor(); } Console.WriteLine(); } /*Password p1 = Password.Initial; * Password p2 = Password.Initial; * Console.WriteLine(Password.Initial); * Console.WriteLine(Password.Initial.Randomized()); * Console.WriteLine($"Scene: {p1.Scene.Value.ToString().PadLeft(4)}, Flags: {p1.Flags.Value:X5}"); * Console.WriteLine($"Scene: {p2.Scene.Value.ToString().PadLeft(4)}, Flags: {p2.Flags.Value:X5}"); * Console.ReadLine();*/ }
protected override void OnEnter(ProcedureOwner procedureOwner) { base.OnEnter(procedureOwner); m_IsChangeSceneComplete = false; GameEntry.Event.Subscribe(LoadSceneSuccessEventArgs.EventId, OnLoadSceneSuccess); GameEntry.Event.Subscribe(LoadSceneFailureEventArgs.EventId, OnLoadSceneFailure); GameEntry.Event.Subscribe(LoadSceneUpdateEventArgs.EventId, OnLoadSceneUpdate); GameEntry.Event.Subscribe(LoadSceneDependencyAssetEventArgs.EventId, OnLoadSceneDependencyAsset); // 停止所有声音 GameEntry.Sound.StopAllLoadingSounds(); GameEntry.Sound.StopAllLoadedSounds(); // 隐藏所有实体 GameEntry.Entity.HideAllLoadingEntities(); GameEntry.Entity.HideAllLoadedEntities(); //卸载所有场景 string[] loadedSceneAssetNames = GameEntry.Scene.GetLoadedSceneAssetNames(); for (int i = 0; i < loadedSceneAssetNames.Length; i++) { GameEntry.Scene.UnloadScene(loadedSceneAssetNames[i]); } //还原游戏速度 GameEntry.Base.ResetNormalGameSpeed(); int sceneId = procedureOwner.GetData <VarInt>(Constant.ProcedureData.NextSceneId).Value; m_CurLoadedSceneId = (SceneId)sceneId; IDataTable <DRScene> dtScene = GameEntry.DataTable.GetDataTable <DRScene>(); DRScene drScene = dtScene.GetDataRow(sceneId); if (drScene == null) { Log.Warning("Can no load scene '{0}' from data table.", sceneId.ToString()); return; } //打开加载进度界面 GameEntry.UI.OpenUIForm(UIFormId.LoadingForm, sceneId); GameEntry.Scene.LoadScene(AssetUtility.GetSceneAsset(drScene.AssetName), sceneId); m_BackgroundMusicId = drScene.BackgroundMusicId; m_SceneName = drScene.SceneName; m_PlayerPos = drScene.PlayerSpawn; GameEntry.Scene.SetCurSceneSpawnPos(m_PlayerPos); }
public void OnInit() { SceneManager.sceneLoaded += OnLevelFinishedLoading; mCurrentSceneId = Parse(SceneManager.GetActiveScene().name); // add new scene here. RegisterScene(SceneId.Loading, typeof(SceneLoading)); RegisterScene(SceneId.MapEditor, typeof(SceneMapEditor)); RegisterScene(SceneId.Map, typeof(SceneMap)); RegisterScene(SceneId.Castle, typeof(SceneCastle)); RegisterScene(SceneId.BattleTest, typeof(SceneBattleTest)); RegisterScene(SceneId.LuaTest, typeof(SceneLuaTest)); RegisterScene(SceneId.NetworkTest, typeof(NetworkTest)); }
IEnumerator CheckSceneLoadStatus() { yield return(new WaitForSeconds(0.1f)); // Start an asynchronous operation to load the scene that was passed to the LoadNewScene coroutine. async = SceneManager.LoadSceneAsync((int)privSceneToLoad); while (!async.isDone) { yield return(null); } Sceneloaded = true; privSceneToLoad = SceneId.Loading; }
static int SwitchToScene(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); MySceneManager obj = (MySceneManager)ToLua.CheckObject(L, 1, typeof(MySceneManager)); SceneId arg0 = (SceneId)ToLua.CheckObject(L, 2, typeof(SceneId)); object arg1 = ToLua.ToVarObject(L, 3); obj.SwitchToScene(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// シーンIDを追加するGUIを表示する /// </summary> void ShowHeader() { using (new EditorGUILayout.HorizontalScope()) { // GUI:シーンIDの列挙体 _selectSceId = (SceneId)EditorGUILayout.EnumPopup( "Add scene", _selectSceId); string sceName = _selectSceId.ToString(); // GUI:追加ボタン if (GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.Width(20))) { _selectSceId = 0; // ビルド設定を再取得 _scenes.Clear(); foreach (var obj in EditorBuildSettings.scenes) { if (obj.enabled) { _scenes.Add(Path.GetFileNameWithoutExtension(obj.path), obj); } } // シーンがビルド設定に存在しないか無効の場合 if (!_scenes.ContainsKey(sceName)) { Log.Warning("シーン({0})がビルド設定に存在しないか無効です", sceName); return; } EditorBuildSettingsScene scene = _scenes[sceName]; // シーンが読み込まれていない場合 Scene loaded = EditorSceneManager.GetSceneByName(sceName); if (loaded.isLoaded) { return; } // 追加モードでシーンをロードする UnityEditor.SceneManagement.EditorSceneManager .OpenScene(scene.path, OpenSceneMode.Additive); _sceNames.Add(sceName); } } }
public void AddSceneEventListener(SceneId sceneId, ISceneEventListener sceneEventListener) { }