public void TriggerLocomotionAction(LocomotionActionEvent action, bool droppable) { action.SessionId = clubPenguinClient.PlayerSessionId; if (action.Object != null && action.Object.type == ObjectType.LOCAL) { List <string> list = new List <string>(); list.Add(action.Object.id); Reward inRoomReward = definitions.GetInRoomReward(list); if (!inRoomReward.isEmpty()) { inRoomRewards[action.Object.id] = ServerTime; CoroutineRunner.StartPersistent(pickupResponse(), this, "pickupResponse"); } } if (currentConsumable != null) { currentConsumable.HandleInteraction(action); } foreach (IConsumable activeConsumable in activeConsumables) { activeConsumable.HandleInteraction(action); } if (currentRoom != null) { currentRoom.HandleInteraction(action); } }
private void startScheduledWorldObjects() { ScheduledWorldObjectConfiguration[] array = UnityEngine.Object.FindObjectsOfType <ScheduledWorldObjectConfiguration>(); foreach (ScheduledWorldObjectConfiguration scheduledWorldObjectConfiguration in array) { List <StatefulWorldObject> list = new List <StatefulWorldObject>(); Transform[] componentsInChildren = scheduledWorldObjectConfiguration.GetComponentsInChildren <Transform>(); foreach (Transform transform in componentsInChildren) { if (!(transform == scheduledWorldObjectConfiguration.transform)) { StatefulWorldObject statefulWorldObject = new StatefulWorldObject(); statefulWorldObject.CreatorId = -1L; statefulWorldObject.Id = new CPMMOItemId(generateMMOItemId(), CPMMOItemId.CPMMOItemParent.WORLD); statefulWorldObject.State = ScheduledWorldObjectState.Inactive; statefulWorldObject.Path = transform.GetPath(); statefulWorldObject.Timestamp = 0L; StatefulWorldObject statefulWorldObject2 = statefulWorldObject; processEvent(GameServerEvent.SERVER_ITEM_ADDED, statefulWorldObject2); CPMMOItemPosition cPMMOItemPosition = default(CPMMOItemPosition); cPMMOItemPosition.Id = statefulWorldObject2.Id; cPMMOItemPosition.Position = transform.position; processEvent(GameServerEvent.SERVER_ITEM_MOVED, cPMMOItemPosition); list.Add(statefulWorldObject2); } } coroutines.Add(CoroutineRunner.StartPersistent(triggerScheduledWorldObjects(scheduledWorldObjectConfiguration, list), this, "triggerScheduledWorldObjects")); } }
public ErrorService() { connectionManager = Service.Get <ConnectionManager>(); gameStateController = Service.Get <GameStateController>(); promptManager = Service.Get <PromptManager>(); sessionManager = Service.Get <SessionManager>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); zoneTransitionService = Service.Get <ZoneTransitionService>(); eventDispatcher = Service.Get <EventDispatcher>(); eventDispatcher.AddListener <ApplicationService.Error>(onError); eventDispatcher.AddListener <SessionErrorEvents.AccountBannedEvent>(onAccountBannedEvent); eventDispatcher.AddListener <SessionErrorEvents.AuthenticationRequiresParentalConsentEvent>(onAuthenticationRequiresParentalConsentEvent); eventDispatcher.AddListener <SessionErrorEvents.AuthenticationRevokedEvent>(onAuthenticationRevokedEvent); eventDispatcher.AddListener <SessionErrorEvents.AuthenticationUnavailableEvent>(onAuthenticationUnavailableEvent); eventDispatcher.AddListener <SessionErrorEvents.SessionTerminated>(onSessionTerminated); eventDispatcher.AddListener <SessionErrorEvents.SessionDataCorrupted>(onSessionDataCorrupted); eventDispatcher.AddListener <SessionErrorEvents.NoNetworkOnResumeError>(onNoNetworkOnResume); eventDispatcher.AddListener <SessionErrorEvents.NoSessionOnResumeError>(onNoSessionOnResume); eventDispatcher.AddListener <SessionErrorEvents.RegistrationConfigError>(onRegistrationConfigError); eventDispatcher.AddListener <WorldServiceErrors.WorldDisconnectedEvent>(onWorldDisconnected); eventDispatcher.AddListener <WorldServiceErrors.WorldNetworkErrorEvent>(onWorldNetworkError); eventDispatcher.AddListener <NetworkErrors.NoConnectionError>(onNoConnectionError); eventDispatcher.AddListener <NetworkErrors.GeneralError>(onGeneralNetworkError); Service.Get <EventDispatcher>().AddListener <LoadingController.TimeoutEvent>(onLoadingScreenTimeout); eventDispatcher.AddListener <WorldServiceEvents.SelfRoomJoinedEvent>(onRoomJoined); CoroutineRunner.StartPersistent(preloadIcons(), this, "Preload error icons"); }
private void runActions(List <InitActionComponent> actions) { List <InitActionComponent> list = new List <InitActionComponent>(); foreach (InitActionComponent action in actions) { bool flag = true; foreach (string topologicalDependency in action.TopologicalDependencies) { if (dependencies.ContainsKey(topologicalDependency)) { flag = false; break; } } if (flag) { list.Add(action); } } activeActions += list.Count; foreach (InitActionComponent item in list) { CoroutineRunner.StartPersistent(runActionAsyc(item), this, "processInitActions:" + item.TopologicalIdentifier); } }
public override void NonRegisteredTransactorUpgradeSend(string lookupValue) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } CoroutineRunner.StartPersistent(delayNonRegisteredTransactorUpgrade(), this, "delay NonRegisteredTransactorUpgrade"); }
public override void ParentalApprovalEmailSend(ILocalUser localUser) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } CoroutineRunner.StartPersistent(delayParentalApprovalEmail(), this, "delay ParentalApprovalEmail"); }
public override void MultipleAccountsResolutionSend(string lookupValue) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } CoroutineRunner.StartPersistent(delayMultipleAccountsResolution(), this, "delay MultipleAccountsResolution"); }
public override void UpdateProfile(string firstName, string parentEmail, IEnumerable <ILegalDocument> legal, ILocalUser localUser) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } CoroutineRunner.StartPersistent(delayProfileUpdated(), this, "delay profile update"); }
public override void UsernameRecoverySend(string lookupValue) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } CoroutineRunner.StartPersistent(delayRecovery(), this, "delay username recovery"); }
public SceneLayoutSyncService(float syncPeriodSeconds) { System.Action callback = delegate { saveIglooLayoutChanges(); }; saveIglooLayoutChangesTimer = new Timer(syncPeriodSeconds, repeat: true, callback); CoroutineRunner.StartPersistent(saveIglooLayoutChangesTimer.Start(), this, "saveIglooLayoutChangesTimer"); }
public override void CreateChildAccount(string firstName, string username, string parentEmail, string password, string language, IEnumerable <KeyValuePair <IMarketingItem, bool> > marketing, IEnumerable <ILegalDocument> legal) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } onCreateChildAccountStart(); CoroutineRunner.StartPersistent(registerAccount(firstName, username, parentEmail, password), this, "register account"); }
public override void Logout(AsynchOnFinishedManifold asynchOnFinishedManifold = null) { if (mixSession != null) { IsLoggingOut = true; mixSession.OnAuthenticationLost -= onAuthenticationLost; asynchOnFinishedManifold?.AsynchStart(); CoroutineRunner.StartPersistent(finishLogout(asynchOnFinishedManifold), this, "Finish Logout"); } }
public override AssetRequest <TAsset> LoadAsync <TAsset>(string deviceList, ref ContentManifest.AssetEntry entry, AssetLoadedHandler <TAsset> handler = null) { Resources.Load <TextAsset>(entry.Key); ResourceRequest unityRequest = Resources.LoadAsync <TextAsset>(entry.Key); AssetRequestWrapper <TAsset> request = new AssetRequestWrapper <TAsset>(null); AsyncAssetRequest <TAsset> asyncAssetRequest = new AsyncAssetRequest <TAsset>(entry.Key, request); CoroutineRunner.StartPersistent(waitForTextAssetToLoad(entry.Key, unityRequest, asyncAssetRequest), this, "test"); return(asyncAssetRequest); }
public override void LogoutLastSession(AsynchOnFinishedManifold asynchOnFinishedManifold = null) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } string languageString = Service.Get <Localizer>().LanguageString; asynchOnFinishedManifold?.AsynchStart(); CoroutineRunner.StartPersistent(delayLogoutLastSession(asynchOnFinishedManifold), this, "delayLogoutLastSession"); }
public override void Login(string username, string password) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } string languageString = Service.Get <Localizer>().LanguageString; onLoginStart(); CoroutineRunner.StartPersistent(delayLogin(username, password), this, "delay login"); }
public override void SoftLogin() { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } string languageString = Service.Get <Localizer>().LanguageString; onSoftLoginStart(); CoroutineRunner.StartPersistent(restoreLastSession(), this, "restore last session"); }
private void getAgeBand(int age, string languageCode, RetryOperation retryOperation = null) { if (this.OnGetAgeBandStart != null) { this.OnGetAgeBandStart(); } if (retryOperation == null) { retryOperation = new RetryOperation(); retryOperation.Method = GetType().GetMethod("getAgeBand", BindingFlags.Instance | BindingFlags.NonPublic); retryOperation.Args = new object[2] { age, languageCode }; retryOperation.retryAttempt = 0; retryOperation.retryDelay = 2; retryOperation.maxRetries = 3; } RegistrationConfig.GetRegistrationAgeBand(age, languageCode, delegate(IGetAgeBandResult result) { if (this.OnGetAgeBandComplete != null) { this.OnGetAgeBandComplete(result.Success); } IsFetchingRegConfig = false; if (result.Success) { RegConfigAttempts = 0; RegistrationAgeBand = result.AgeBand; Dictionary <string, string> attributes = new Dictionary <string, string> { { "swrve.device_region", RegistrationAgeBand.CountryCode } }; Service.Get <ICPSwrveService>().UserUpdate(attributes); if (this.OnRegistrationConfigUpdated != null) { this.OnRegistrationConfigUpdated(RegistrationConfig); } } else { if (retryCoroutine != null && !retryCoroutine.Disposed) { retryCoroutine.Stop(); } retryCoroutine = CoroutineRunner.StartPersistent(executeRetryOperation(retryOperation), this, "Registration AgeBand retry"); } }); }
public void Init(Tweaker tweaker, ITweakerSerializer serializer) { logger.Info("Init: " + tweaker); Tweaker = tweaker; Serializer = serializer; Tweaker.Scanner.ScanInstance(GridController); GridController.Init(); Refresh(); keyBindingManager = base.gameObject.transform.parent.gameObject.AddComponent <KeyBindingManager>(); keyBindingManager.Init(Tweaker.Invokables.GetInvokables().Values.ToArray()); CoroutineRunner.StartPersistent(checkShouldActivate(), this, "checkShouldActivate"); }
public override void GetRegistrationConfig(Action <IGetRegistrationConfigurationResult> callback = null, RetryOperation retryOperation = null) { if (NetworkConfigIsNotSet) { throw new NullReferenceException("NetworkServicesConfig not set"); } base.IsFetchingRegConfig = true; if (callback == null) { onGetRegistrationConfigStart(); CoroutineRunner.StartPersistent(registractionCallback(), this, "get registration"); } }
private bool onLocalPlayerDataReady(NetworkControllerEvents.LocalPlayerDataReadyEvent evt) { if (offlineDatabase.Read <CustomEquipmentCollection>().Equipment.Count == 0) { INetworkServicesManager network = Service.Get <INetworkServicesManager>(); network.InventoryService.GetEquipmentInventory(); network.IglooService.GetDecorations(); dataEntityCollection.When(dataEntityCollection.LocalPlayerHandle, delegate(SavedIgloosMetaData savedIgloosMetaData) { CoroutineRunner.StartPersistent(loadIglooEntity(network, savedIgloosMetaData), this, "loadIglooEntity"); }); } return(false); }
public void JoinRoom(SignedResponse <JoinRoomData> signedJoinRoomData) { currentRoom = Service.Get <IOfflineRoomFactory>().Create(signedJoinRoomData.Data.room, processEvent, generateMMOItemId, partyGameSessionManager); currentRoom.Start(); clubPenguinClient.PlayerSessionId = signedJoinRoomData.Data.sessionId; clubPenguinClient.PlayerName = signedJoinRoomData.Data.userName; inRoomRewards = signedJoinRoomData.Data.earnedRewards; if (inRoomRewards == null) { inRoomRewards = new Dictionary <string, long>(); } setCurrentQuest(signedJoinRoomData.Data.playerRoomData.quests); CoroutineRunner.StartPersistent(joinRoomResponse(), this, "joinRoomResponse"); }
public QuestService(Manifest manifest, PersistentBreadcrumbTypeDefinitionKey breadcrumbType) { this.breadcrumbType = breadcrumbType; dispatcher = Service.Get <EventDispatcher>(); MascotService mascotService = Service.Get <MascotService>(); List <QuestDefinition> list = new List <QuestDefinition>(); ScriptableObject[] assets = manifest.Assets; foreach (ScriptableObject scriptableObject in assets) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(scriptableObject.name); Mascot mascot = mascotService.GetMascot(fileNameWithoutExtension); ScriptableObject[] assets2 = ((Manifest)scriptableObject).Assets; foreach (ScriptableObject scriptableObject2 in assets2) { QuestDefinition questDefinition = (QuestDefinition)scriptableObject2; knownQuests[scriptableObject2.name] = questDefinition; questToMascotMap[scriptableObject2.name] = mascot; list.Add(questDefinition); } mascot.KnownQuests = list.ToArray(); list.Clear(); } eventChannel = new EventChannel(dispatcher); eventChannel.AddListener <QuestEvents.SuspendQuest>(onSuspendQuestRequest); eventChannel.AddListener <QuestEvents.ResumeQuest>(onResumeQuestRequest); eventChannel.AddListener <QuestEvents.StartQuest>(onStartQuestRequest); eventChannel.AddListener <QuestEvents.ReplayQuest>(onReplayQuestRequest); eventChannel.AddListener <QuestEvents.RestartQuest>(onRestartQuestRequest); eventChannel.AddListener <SplashScreenEvents.SplashScreenOpened>(onSplashScreenOpened); eventChannel.AddListener <SplashScreenEvents.SplashScreenClosed>(onSplashScreenClosed); eventChannel.AddListener <QuestEvents.QuestUpdated>(onQuestUpdated); eventChannel.AddListener <QuestEvents.QuestInitializationComplete>(onQuestInitializationComplete); eventChannel.AddListener <RewardEvents.RewardPopupComplete>(onRewardPopupComplete); eventChannel.AddListener <QuestEvents.SetPlayerOutOfWorld>(onSetPlayerOutOfWorld); eventChannel.AddListener <SceneTransitionEvents.TransitionStart>(onSceneTransition); eventChannel.AddListener <QuestEvents.RegisterQuestSubFsm>(onRegisterQuestSubFsm); eventChannel.AddListener <InWorldUIEvents.DisableActionIndicators>(onDisableActionIndicators); eventChannel.AddListener <InWorldUIEvents.EnableActionIndicators>(onEnableActionIndicators); eventChannel.AddListener <QuestServiceEvents.QuestStatesRecieved>(onQuestStatesReceived); eventChannel.AddListener <QuestServiceErrors.QuestProgressionError>(onQuestProgressionError); eventChannel.AddListener <ProgressionEvents.LevelUp>(onLevelUp); updateQuestGivers(0); timeLockedCheckTimer = new Timer(2f, repeat: true, delegate { onTimerTick(); }); CoroutineRunner.StartPersistent(timeLockedCheckTimer.Start(), this, "timeLockedQuestTimer"); }
public override void PauseSession(bool immediately = false) { if (HasSession) { eventDispatcher.DispatchEvent(default(SessionEvents.SessionPausingEvent)); if (immediately) { eventDispatcher.DispatchEvent(default(SessionEvents.SessionPausedEvent)); } else { CoroutineRunner.StartPersistent(delayPause(), this, "delay pause"); } } }
public override void OnEnter() { if (!SceneName.IsNone && !string.IsNullOrEmpty(SceneName.Value)) { if (SceneManager.GetActiveScene().name == SceneName.Value) { Service.Get <EventDispatcher>().DispatchEvent(new HudEvents.PermanentlySuppressQuestNotifier(Suppress, AutoShow)); } Finish(); } else { CoroutineRunner.StartPersistent(SendSuppressEvent(), this, "SuppressQuestNotifierAction"); } }
public void LoadScene(string scene, string transitionScene, Dictionary <string, object> sceneArgs = null, bool allowActivation = true) { if (IsTransitioning) { Log.LogError(this, "LoadScene called when a scene transition is currently taking place."); } else if (!appService.IsAppResuming) { if (string.IsNullOrEmpty(transitionScene)) { transitionScene = "Loading"; } IsTransitioning = true; dispatcher.DispatchEvent(new SceneTransitionEvents.SetIsTransitioningFlag(isTransitioning: true)); CoroutineRunner.StartPersistent(loadScene(scene, transitionScene, sceneArgs, allowActivation), this, "loadScene-" + scene); } }
public void Execute() { ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (clubPenguinClient.OfflineMode && string.IsNullOrEmpty(commonGameSettings.CPAPIServicehost)) { CoroutineRunner.StartPersistent(runOffline(), this, "execute"); return; } if (string.IsNullOrEmpty(commonGameSettings.CPAPIServicehost)) { OnResponse += delegate { operation.UpdateOfflineData(); }; } clubPenguinClient.RecoverableOperationService.SendOperation(operation, this.OnResponse, this.OnError, this.OnComplete); }
public void EndSession(long userSessionId) { timer.Stop(); JsonService jsonService = Service.Get <JsonService>(); PartyGameSessionMessages.TubeRacePlayerResult tubeRacePlayerResult = new PartyGameSessionMessages.TubeRacePlayerResult(); tubeRacePlayerResult.CompletionTimeInMilliseconds = timer.ElapsedMilliseconds; tubeRacePlayerResult.OverallScore = raceDefinition.StartingPoints - timer.ElapsedMilliseconds * raceDefinition.PointsDeductedPerSecond / 1000 + userScores[userSessionId]; tubeRacePlayerResult.PlayerId = userSessionId; tubeRacePlayerResult.ScoreModifier = userScores[userSessionId]; PartyGameSessionMessages.TubeRacePlayerResult objectToSerialize = tubeRacePlayerResult; PartyGameMessageEvent partyGameMessageEvent = default(PartyGameMessageEvent); partyGameMessageEvent.sessionId = sessionId; partyGameMessageEvent.type = 13; partyGameMessageEvent.message = jsonService.Serialize(objectToSerialize); PartyGameMessageEvent partyGameMessageEvent2 = partyGameMessageEvent; processEvent(GameServerEvent.PARTY_GAME_MESSAGE, partyGameMessageEvent2); if (Service.Get <IGameData>().Get <Dictionary <int, PartyGameDefinition> >().TryGetValue(cpItem.gameTemplateId, out var value)) { foreach (PartyGameDefinition.PartyGameReward reward in value.Rewards) { if (reward.Placement == PartyGameEndPlacement.FIRST) { Dictionary <string, RewardJsonReader> dictionary = new Dictionary <string, RewardJsonReader>(); dictionary.Add(userSessionId.ToString(), jsonService.Deserialize <RewardJsonReader>(jsonService.Serialize(RewardJsonWritter.FromReward(reward.Reward.ToReward())))); SignedResponse <RewardedUserCollectionJsonHelper> signedResponse = new SignedResponse <RewardedUserCollectionJsonHelper>(); signedResponse.Data = new RewardedUserCollectionJsonHelper { rewards = dictionary, source = RewardSource.MINI_GAME, sourceId = sessionId.ToString() }; SignedResponse <RewardedUserCollectionJsonHelper> arg = signedResponse; processEvent(GameServerEvent.RECEIVED_REWARDS_DELAYED, arg); break; } } } CoroutineRunner.StartPersistent(finishEndSession(), this, "finishEndSession"); }
public override void ResumeSession() { if (HasSession) { if (Service.Get <ConnectionManager>().ConnectionState == ConnectionManager.NetworkConnectionState.NoConnection) { Service.Get <EventDispatcher>().DispatchEvent(default(SessionErrorEvents.NoNetworkOnResumeError)); return; } LoadingController loadingController = Service.Get <LoadingController>(); if (!loadingController.HasLoadingSystem(this)) { loadingController.AddLoadingSystem(this); } CoroutineRunner.StartPersistent(delayResume(), this, "delay resume"); } else { Service.Get <EventDispatcher>().DispatchEvent(default(SessionErrorEvents.NoSessionOnResumeError)); } }
private void startTubeRacingSchedule() { Dictionary <int, PartyGameLauncherDefinition> dictionary = Service.Get <IGameData>().Get <Dictionary <int, PartyGameLauncherDefinition> >(); TubeRaceLobby[] array = UnityEngine.Object.FindObjectsOfType <TubeRaceLobby>(); TubeRaceLobby[] array2 = array; foreach (TubeRaceLobby tubeRaceLobby in array2) { PartyGameDefinition gameDefinition = tubeRaceLobby.GameDefinition; if (!(gameDefinition != null) || !dictionary.TryGetValue(gameDefinition.Id, out var value)) { continue; } PartyGameLobbyMmoItemTeamDefinition partyGameLobbyMmoItemTeamDefinition = gameDefinition.LobbyData as PartyGameLobbyMmoItemTeamDefinition; if (partyGameLobbyMmoItemTeamDefinition != null) { TubeRaceDefinition tubeRaceDefinition = gameDefinition.GameData as TubeRaceDefinition; if (tubeRaceDefinition != null) { coroutines.Add(CoroutineRunner.StartPersistent(triggerTubeRace(partyGameLobbyMmoItemTeamDefinition, gameDefinition.Id, value.EveryXMinutesAfterTheHour, tubeRaceDefinition), this, "triggerTubeRace")); } } } }
public void Start(IEnumerator enumerator) { activeCoroutines.Add(enumerator, CoroutineRunner.StartPersistent(enumerator, this, "MixCoroutine")); }