private void Loop() { // Loop until stopped while (IsRunning) { // If configuration is loaded, check and output scores if (ConfigurationManager.LoadedConfigFromFile) { ScoringManager.CheckAndOutput(); } // Allow configuration to check for any config updates ConfigurationManager.Loop(); // Allow translation manager to check for updates TranslationManager.Loop(); // Delay by loop delay length of milliseconds // If StopRequest.Set is called during delay, will return true if (StopRequest.WaitOne(LoopDelay)) { IsRunning = false; break; } } }
private static void OnAskForAvatarRankingListMessageReceived(AskForAvatarRankingListMessage message, ServerSessionMessage requestMessage) { if (message.GetVillageType() == 1) { AvatarDuelRankingListMessage avatarDuelRankingListMessage = new AvatarDuelRankingListMessage(); LogicLong avatarId = message.RemoveAvatarId(); avatarDuelRankingListMessage.SetAvatarRankingList(ScoringManager.GetAvatarDuelRankingList(avatarId)); avatarDuelRankingListMessage.SetNextEndTimeSeconds(ScoringManager.GetNextEndTimeSeconds()); avatarDuelRankingListMessage.SetSeasonMonth(ScoringManager.GetSeasonMonth()); avatarDuelRankingListMessage.SetSeasonYear(ScoringManager.GetSeasonYear()); avatarDuelRankingListMessage.SetLastSeasonAvatarRankingList(ScoringManager.GetLastSeasonAvatarDuelRankingList(avatarId)); avatarDuelRankingListMessage.SetLastSeasonMonth(ScoringManager.GetLastSeasonMonth()); avatarDuelRankingListMessage.SetLastSeasonYear(ScoringManager.GetLastSeasonYear()); ServerMessageManager.SendMessage(ScoringMessageManager.CreateForwardLogicMessage(avatarDuelRankingListMessage, requestMessage.SessionId), ServerManager.GetProxySocket(requestMessage.SessionId)); } else { AvatarRankingListMessage avatarRankingListMessage = new AvatarRankingListMessage(); LogicLong avatarId = message.RemoveAvatarId(); avatarRankingListMessage.SetAvatarRankingList(ScoringManager.GetAvatarRankingList(avatarId)); avatarRankingListMessage.SetNextEndTimeSeconds(ScoringManager.GetNextEndTimeSeconds()); avatarRankingListMessage.SetSeasonMonth(ScoringManager.GetSeasonMonth()); avatarRankingListMessage.SetSeasonYear(ScoringManager.GetSeasonYear()); avatarRankingListMessage.SetLastSeasonAvatarRankingList(ScoringManager.GetLastSeasonAvatarRankingList(avatarId)); avatarRankingListMessage.SetLastSeasonMonth(ScoringManager.GetLastSeasonMonth()); avatarRankingListMessage.SetLastSeasonYear(ScoringManager.GetLastSeasonYear()); ServerMessageManager.SendMessage(ScoringMessageManager.CreateForwardLogicMessage(avatarRankingListMessage, requestMessage.SessionId), ServerManager.GetProxySocket(requestMessage.SessionId)); } }
void Start() { var dinnerPartyGlobals = GameObject.Find("Globals").GetComponent <DinnerPartyGlobals>(); var numStars = ScoringManager.CalcScoreStars(dinnerPartyGlobals.currentPartyState, dinnerPartyGlobals.requirements); Score(numStars); }
// ================================================================ // void Start() { m_musicManager = GameObject.Find("MusicManager").GetComponent <MusicManager>(); m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); SetPhase("Startup"); }
protected override void OnStart(string[] args) { // Load configuration string startupParameter = ""; if (args != null && args.Length > 1) { // Skip first command line argument, as it is the current directory startupParameter = args[1]; } // Setup scoring manager ScoringManager.Setup(); // Start up configuration ConfigurationManager.Startup(startupParameter); // Setup output manager OutputManager.Setup(); // Create thread with loop function LoopThread = new Thread(Loop); // Run thread IsRunning = true; LoopThread.Start(); }
public void BeginVisualization(RESULT result) { m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); string[] comments; switch (result) { default: case RESULT.EXCELLENT: comments = this.comments_EXCELLENT; break; case RESULT.GOOD: comments = this.comments_GOOD; break; case RESULT.BAD: comments = this.comments_BAD; break; } this.uiCommentText.text = ""; foreach (var comment in comments) { this.uiCommentText.text += comment; this.uiCommentText.text += "\n"; } this.uiScoreText.text = m_scoringManager.score.ToString(); }
public void OnWin(Character winner) { PlayerManager.RegisterCharacterReference(); ScoringManager.RegisterCharacterScore(); PlayerManager.ClearPlayer(); SceneHandler.ChangeScene("FinalScreen"); }
public void GoToMenu() { GameDataManager.ResetDatas(); ScoringManager.ResetScore(); PlayerManager.ClearPlayer(); SceneHandler.ChangeScene("MainScreen"); }
//called on event OnParticleCollisions public void SwitchToDefeatPhase(GameObject LooseObject) { GameStateEnum.gameStateEnum = GameStateEnum.GAMESTATE.Loose; LooseObject.SetActive(false); ScoringManager.nbDeath++; ScoringManager.LooseCheck(); }
private static void OnAskForAllianceRankingListMessageReceived(AskForAllianceRankingListMessage message, ServerSessionMessage requestMessage) { if (message.GetLocalRanking()) { AllianceLocalRankingListMessage allianceLocalRankingListMessage = new AllianceLocalRankingListMessage(); allianceLocalRankingListMessage.SetAllianceRankingList(new LogicArrayList <AllianceRankingEntry>(0)); allianceLocalRankingListMessage.SetVillageType(message.GetVillageType()); ServerMessageManager.SendMessage(ScoringMessageManager.CreateForwardLogicMessage(allianceLocalRankingListMessage, requestMessage.SessionId), ServerManager.GetProxySocket(requestMessage.SessionId)); } else { AllianceRankingListMessage allianceRankingListMessage = new AllianceRankingListMessage(); allianceRankingListMessage.SetAllianceRankingList(ScoringManager.GetAllianceRankingList(message.GetVillageType(), message.RemoveAllianceId())); allianceRankingListMessage.SetDiamondPrizes(ScoringManager.GetDiamondPrizes()); allianceRankingListMessage.SetNextEndTimeSeconds(ScoringManager.GetNextEndTimeSeconds()); allianceRankingListMessage.SetVillageType(message.GetVillageType()); ServerMessageManager.SendMessage(ScoringMessageManager.CreateForwardLogicMessage(allianceRankingListMessage, requestMessage.SessionId), ServerManager.GetProxySocket(requestMessage.SessionId)); } }
void Start() { scoring = this; score = 0; highScore = PlayerPrefs.GetInt("HighScore", score); reset(); audio2 = GetComponent <AudioSource> (); }
public static void Init() { ServerScoring.GameDatabase = new CouchbaseDatabase("magic-players", "game"); ServerScoring.AllianceDatabase = new CouchbaseDatabase("magic-alliances", "data"); ServerScoring.SeasonDatabase = new CouchbaseDatabase("magic-seasons", "season"); ScoringManager.Init(); }
// Start is called before the first frame update void Start() { var dinnerPartyGlobals = GameObject.Find("Globals").GetComponent <DinnerPartyGlobals>(); var feedback = ScoringManager.GetFeedbackStrings(dinnerPartyGlobals.currentPartyState, dinnerPartyGlobals.requirements); ReplaceNamesInFeedbackStrings(feedback, dinnerPartyGlobals.Persons); AddFeedbackToQueue(feedback); }
/// <summary> /// 播放观众的欢呼音效 /// </summary> public override void OnBegin() { ScoringManager scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); if (scoringManager.temper > ScoringManager.temperThreshold) { GameObject.Find("AudienceVoice").GetComponent <AudioSource>().Play(); } }
// ================================================================ // public void BeginVisualization() { m_musicManager = GameObject.Find("MusicManager").GetComponent <MusicManager>(); m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); m_seekerBack.SetSequence(m_musicManager.currentSongInfo.onBeatActionSequence); m_seekerFront.SetSequence(m_musicManager.currentSongInfo.onBeatActionSequence); m_seekerBack.Seek(markerLeaveOffset); m_seekerFront.Seek(markerEnterOffset); }
private static void OnAskForAvatarDuelLastSeasonRankingListMessageReceived(AskForAvatarDuelLastSeasonRankingListMessage message, ServerSessionMessage requestMessage) { AvatarDuelLastSeasonRankingListMessage avatarDuelLastSeasonRankingListMessage = new AvatarDuelLastSeasonRankingListMessage(); avatarDuelLastSeasonRankingListMessage.SetAvatarRankingList(ScoringManager.GetLastSeasonAvatarDuelRankingList(message.RemoveAvatarId())); avatarDuelLastSeasonRankingListMessage.SetSeasonYear(ScoringManager.GetLastSeasonYear()); avatarDuelLastSeasonRankingListMessage.SetSeasonMonth(ScoringManager.GetLastSeasonMonth()); ServerMessageManager.SendMessage(ScoringMessageManager.CreateForwardLogicMessage(avatarDuelLastSeasonRankingListMessage, requestMessage.SessionId), ServerManager.GetProxySocket(requestMessage.SessionId)); }
private void Awake() { if (FindObjectsOfType <ScoringManager>().Length > 1) { Destroy(this); } else { instance = this; } }
void Start() { m_musicManager = GameObject.Find("MusicManager").GetComponent <MusicManager>(); m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); m_eventManager = GameObject.Find("EventManager").GetComponent <EventManager>(); //因为GUI对象有Inactie的可能性,所以不能在Find直接访问。 m_onPlayGUI = GameObject.Find("PhaseManager").GetComponent <PhaseManager>().guiList[1].GetComponent <OnPlayGUI>(); m_playerAction = GameObject.Find("PlayerAvator").GetComponent <PlayerAction>(); m_seekSlider.is_now_dragging = false; m_seekSlider.dragging_poisition = 0.0f; }
public override void OnReceiveCoreMessage(ServerCoreMessage message) { switch (message.GetMessageType()) { case ServerMessageType.SERVER_PERFORMANCE: ServerMessageManager.SendMessage(new ServerPerformanceDataMessage(), message.Sender); break; case ServerMessageType.SCORING_SYNC: ScoringManager.OnScoringSyncMessageReceived((ScoringSyncMessage)message); break; } }
public event Action OnScoreChanged; // Called when the score changes //Awake is always called before any Start functions void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a ScoringManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); }
protected override void OnStart(string[] args) { // Load configuration string configPath = ""; string translationsPath = ""; if (args != null) { // Skip first command line argument, as it is the current directory if (args.Length > 1) { configPath = args[1]; } // Second argument is translations file if (args.Length > 2) { translationsPath = args[2]; } } // Setup scoring manager ScoringManager.Setup(); // Start up configuration ConfigurationManager.Startup(configPath); // Start up translation manager TranslationManager.Startup(translationsPath); // Setup output manager OutputManager.Setup(); // Create thread with loop function LoopThread = new Thread(Loop); // Run thread IsRunning = true; LoopThread.Start(); }
void Start() { m_musicManager = GameObject.Find("MusicManager").GetComponent <MusicManager>(); m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); m_playerAvator = GameObject.Find("PlayerAvator"); m_kMato = transform.Find("mato").gameObject; Debug.Assert(m_kMato != null); fScale = Screen.width / 750.0f; m_fMarkWeight = 86 * fScale; m_fMarkerOriginX = 30 * fScale; m_fMarkerOriginY = (1334 - 215) * fScale; //-每秒移动这么多 m_pixelsPerBeatsY = (Screen.height * fScale - 408 * fScale) * 1.0f / markerEnterOffset; //Object kHitEffect = Resources.Load("Perfeb/HitEffect", typeof(GameObject)); //m_kHitEffects[0] = Instantiate(kHitEffect) as GameObject; //m_kHitEffects[1] = Instantiate(kHitEffect) as GameObject; //m_kHitEffects[2] = Instantiate(kHitEffect) as GameObject; //m_kHitEffects[3] = Instantiate(kHitEffect) as GameObject; }
private static void loadConfig(bool loadedPrev = false) { // If file/directory doesn't exist if (!checkFiles()) { // Stop loading configuration return; } // If config has been loaded already if (loadedPrev) { // Resetup the scoring manager to clear current configs, // We need to clear current configs incase the newly loaded config file has had a section removed // If this is the case, unless we clear current configs, the section that was removed will persist // through the new loading ScoringManager.Setup(); } /* Open file with only read permissions. * We don't need write permissions as we want * as little file permission errors to occur * as possible. We do not need write permissions * until it is time to save */ using (ConfigFileStream = File.Open(CurrentConfigPath, FileMode.Open, FileAccess.Read)) { LastUpdated = File.GetLastWriteTime(CurrentConfigPath); try { // Create aes managed class for creating decryptor AesManaged aesManaged = new AesManaged(); aesManaged.KeySize = 256; aesManaged.Mode = CipherMode.CBC; aesManaged.Padding = PaddingMode.PKCS7; aesManaged.Key = Encoding.ASCII.GetBytes(Key); aesManaged.IV = Encoding.ASCII.GetBytes(IV); ICryptoTransform decryptor = aesManaged.CreateDecryptor(); // Crypto stream to decrypt config file using (CryptoStream cryptoStream = new CryptoStream(ConfigFileStream, decryptor, CryptoStreamMode.Read)) // Binary reader for parsing of data using (BinaryReader reader = new BinaryReader(cryptoStream)) { loadOutputFiles(reader); // Get number of sections int count = reader.ReadInt32(); // For each config section, load it for (int i = 0; i < count; i++) { // Get config section type ESectionType type = (ESectionType)reader.ReadInt32(); // Get length of data for specific section int bufferLength = reader.ReadInt32(); // Read buffer for section to isolate from others byte[] buffer = reader.ReadBytes(bufferLength); // Find section for loading ISection config = ScoringManager.ScoringSections.FirstOrDefault(x => x.Type == type); // Possibly removed section, skip it if (config == null) { continue; } // Create isolated binary reader for section loading using (MemoryStream bufferStream = new MemoryStream(buffer)) using (BinaryReader sectionReader = new BinaryReader(bufferStream)) { try { // Load config config.Load(sectionReader); } catch { // Issue with specific section, likely something was added to section // But it's an outdated config file } } } } } catch { // Likely outdated configuration file with updated program. No action is likely needed. // TODO, add version checking to allow outdated configuration files } LoadedConfigFromFile = true; } }
void Start() { m_musicManager = GameObject.Find("MusicManager").GetComponent <MusicManager>(); m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); m_playerAvator = GameObject.Find("PlayerAvator"); }
void Start() { m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>(); }