private static void TryEnqueueNewFollower() { Simulation simulation = SimulationUtil.GetSimulation(); Client loadedClient = ClientUtil.GetClient(); ClientUtil.LoadClient(out loadedClient); Client localClient = ClientUtil.GetClient(); for (int i = 0; i < loadedClient.Followers.Count; i++) { Follower loadedFollower = loadedClient.Followers[i]; Follower clientFollower = null; if (ExistInClient(out clientFollower, loadedFollower)) { if (loadedFollower.Messages.Count != clientFollower.Messages.Count) { clientFollower.Messages.Add(loadedFollower.Messages[loadedFollower.Messages.Count - 1]); } continue; } Follower followerToEnqueue = CreateFollower(loadedFollower.UserName, loadedFollower.Messages[loadedFollower.Messages.Count - 1]); localClient.Followers.Add(followerToEnqueue); Debug.Log("Added client to chat: " + followerToEnqueue.UserName); simulation.FollowersToAdd.Enqueue(followerToEnqueue); } }
private static void TryDequeueNewFollowers() { Simulation simulation = SimulationUtil.GetSimulation(); Client client = ClientUtil.GetClient(); if (!string.IsNullOrEmpty(simulation.NewFollower.UserName) || simulation.FollowersToAdd.Count == 0) { return; } simulation.NewFollower = simulation.FollowersToAdd.Dequeue(); }
private static void GUI_DrawDebugUsers(int id) { GUILayout.Label("Username:"******"Add")) { var follower = FollowerUtil.CreateFollower(addUser_UserName, new FollowerMessageInfo()); SingletonUtil.GetMain().Client.Followers.Add(follower); SimulationUtil.GetSimulation().FollowersToAdd.Enqueue(follower); } }
private static void UpdateNewFollower() { Simulation simulation = SimulationUtil.GetSimulation(); Client client = ClientUtil.GetClient(); if (string.IsNullOrEmpty(simulation.NewFollower.UserName)) { return; } simulation.CurrentTimeDisplayFollower += Time.deltaTime / simulation.TimeDisplayFollower; if (simulation.CurrentTimeDisplayFollower >= 1) { simulation.NewFollower = new Follower(); simulation.NewFollower.Messages = new List <FollowerMessageInfo>(); simulation.CurrentTimeDisplayFollower = 0; } }
public void Login() { LoginPanelComponent loginPanelComponent = (LoginPanelComponent)UIPanelUtil.GetUIPanel(PanelType.LOGIN); Client client = ClientUtil.GetClient(); client.UserName = loginPanelComponent.InputField_Username.text; client.AccessToken = loginPanelComponent.InputField_Token.text; client.ReadMessages = false; client.Followers = new List <Follower>(); ClientUtil.SetClient(); Simulation simulation = SimulationUtil.GetSimulation(); ProcessStartInfo backEnd = new ProcessStartInfo(); backEnd.FileName = "TwitchChat_bckEnd.exe"; backEnd.WorkingDirectory = AccessUtil.GetBackEndProcessPath(); simulation.Backend = Process.Start(backEnd); }
public static void ManagePanels() { UIHolder uiHolder = UIUtil.GetUIHolder(); Simulation simulation = SimulationUtil.GetSimulation(); State currentState = SimulationUtil.GetCurrentState(); State lastState = SimulationUtil.GetLastState(); PanelType currentPanel = GetPanelTypeByState(currentState); PanelType lastPanel = GetPanelTypeByState(lastState); if (!IsPanelOpenned(currentPanel) && uiHolder.PanelToOpen == PanelType.NONE) { uiHolder.PanelToOpen = currentPanel; } if (uiHolder.PanelToClose == PanelType.NONE) { for (int i = 0; i < uiHolder.InstantiatedPanels.Count; i++) { PanelType instantiatedPanelType = uiHolder.InstantiatedPanels[i]; UIPanel instantiatedPanel = GetUIPanel(instantiatedPanelType); State desiredState = SimulationUtil.GetStateByPanelType(instantiatedPanelType); if (instantiatedPanel.gameObject.activeSelf && !simulation.States.Contains(desiredState)) { uiHolder.PanelToClose = instantiatedPanelType; break; } } } ManageOpenningPanel(); ManageClosingPanels(); UpdateOppenedPanels(); }
private static bool GetCharacterActiveState(Character character) { //CHARACTER WILL ONLY SHOW UP IF HE IS NOT IN FOLLOWERS TO ADD QUEUE AND IF HE IS NOT BEN SHWING AT //THE NEW FOLLOWER OBEJCT Client client = ClientUtil.GetClient(); Simulation simulation = SimulationUtil.GetSimulation(); Chat chat = GetChat(); if (character.FollowerReference.UserName == simulation.NewFollower.UserName) { return(false); } foreach (Follower follower in simulation.FollowersToAdd) { if (follower.UserName == character.FollowerReference.UserName) { return(false); } } return(true); }