Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (m_CommandWindow == null)
        {
            m_CommandWindow = FindObjectOfType <CommandWindow>();
            if (m_CommandWindow != null)
            {
                m_CommandWindow.onMessageSentCallback += OnMessageSentCallback;
                m_ClientWorld.GetExistingSystem <S_HandleTextReceived>().CommandWindow = m_CommandWindow;
            }
        }

        if (m_FeedbackWindow == null)
        {
            m_FeedbackWindow = FindObjectOfType <FeedbackWindow>();
            if (m_FeedbackWindow != null)
            {
                m_ClientWorld.GetExistingSystem <S_HandleVisorMessageReceived>().FeedbackWindow = m_FeedbackWindow;
            }
        }

        if (m_AssetDatabase == null)
        {
            m_AssetDatabase = FindObjectOfType <GameAssetDatabase>();
            if (m_AssetDatabase != null)
            {
                m_ClientWorld.GetExistingSystem <S_HandleTextReceived>().GameAssetDatabase = m_AssetDatabase;
            }
        }

        ug_Network.Update();

        m_ClientWorld.EntityManager.CompleteAllJobs();
        b_EndOfFrame.Update();
    }
Exemple #2
0
        public async Task Stop()
        {
            CommandWindow.Log("Stopping round");
            RoundManager.Broadcast("Round has ended.");
            RoundTime = 600;

            State = RoundState.INTERMISSION;

            await Task.Delay(6000);

            Players.ToList().ForEach(p =>
            {
                if (p.Status == PlayerStatus.ALIVE)
                {
                    p.ReviveUnsafe();
                    TTTPlayer.ClearInventoryUnsafe(PlayerTool.getSteamPlayer(p.SteamID));
                }
            });

            await Task.Delay(6000);

            State = RoundState.SETUP;

            LevelManager.ClearBarricadesUnsafe();
            C4Manager.ClearC4();
            TrackerGunManager.ClearTrackedPlayers();
        }
Exemple #3
0
        public void Run()
        {
            Window        win    = dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
            CommandWindow comwin = (CommandWindow)win.Object;

            comwin.SendInput(command, true);
        }
        private void AddCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new TimerCommandDetailsControl());

            window.Closed += Window_Closed;
            window.Show();
        }
Exemple #5
0
        public BasicInteractiveCommandEditorControl(CommandWindow window, InteractiveCommand command)
        {
            this.window  = window;
            this.command = command;

            InitializeComponent();
        }
        private void NewEntranceCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(new CustomCommand(UserDataEditorWindowViewModel.UserEntranceCommandName)));

            window.CommandSaveSuccessfully += NewEntranceCommandWindow_CommandSaveSuccessfully;
            window.Show();
        }
        private void NewInteractiveCommandButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            InteractiveControlCommandItem command = (InteractiveControlCommandItem)button.DataContext;
            CommandWindow window = null;

            if (command.Control is InteractiveButtonControlModel)
            {
                window = new CommandWindow(new InteractiveButtonCommandDetailsControl(this.selectedGame, this.selectedGameVersion, this.selectedScene, (InteractiveButtonControlModel)command.Control));
            }
            else if (command.Control is InteractiveJoystickControlModel)
            {
                window = new CommandWindow(new InteractiveJoystickCommandDetailsControl(this.selectedGame, this.selectedGameVersion, this.selectedScene, (InteractiveJoystickControlModel)command.Control));
            }
            else if (command.Control is InteractiveTextBoxControlModel)
            {
                window = new CommandWindow(new InteractiveTextBoxCommandDetailsControl(this.selectedGame, this.selectedGameVersion, this.selectedScene, (InteractiveTextBoxControlModel)command.Control));
            }

            if (window != null)
            {
                window.Closed += Window_Closed;
                window.Show();
            }
        }
        public AdvancedCommandEditorControl(CommandWindow window, CommandDetailsControlBase commandDetailsControl)
        {
            this.window = window;
            this.commandDetailsControl = commandDetailsControl;

            InitializeComponent();
        }
Exemple #9
0
        public override void Execute()
        {
            try
            {
                DTE service = (DTE)this.GetService(typeof(DTE));
                list = new ErrorList(service);

                if (IsDisposeCheckerInstalled())
                {
                    string   disposeCheckerPath = "";
                    string[] folders            = new string[] {
                        Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe")
                    };
                    bool disposeCheckerFound = false;
                    foreach (string path in folders)
                    {
                        if (File.Exists(path))
                        {
                            disposeCheckerFound = true;
                            disposeCheckerPath  = path;
                            break;
                        }
                    }

                    if (!disposeCheckerFound)
                    {
                        MessageBox.Show("SPDisposeCheck not found at installation location");
                    }

                    //first check for rebuild
                    foreach (Project project in Helpers.GetSelectedProjects(service))
                    {
                        if (DeploymentHelpers.CheckRebuildForProject(service, project))
                        {
                        }
                    }

                    foreach (Project project in Helpers.GetSelectedProjects(service))
                    {
                        currentProject = project;
                        string projectpath = project.FullName;
                        projectpath = projectpath.Substring(0, projectpath.LastIndexOf('\\', projectpath.Length - 2));
                        RunProcess(service, disposeCheckerPath, "\"" + projectpath + "\"");
                    }
                }
                else
                {
                    if (MessageBox.Show("SPDisposeCheck is not installed. Go to download page?", "Not installed", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Window        win    = service.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
                        CommandWindow comwin = (CommandWindow)win.Object;
                        comwin.SendInput("nav \"http://code.msdn.microsoft.com/SPDisposeCheck\"", true);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #10
0
        private void NewCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(new CustomCommand("Outcome Game Command")));

            window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully;
            window.Show();
        }
Exemple #11
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        private async Task RoundTimeTick()

        {
            if (GetState() == RoundState.SETUP && GetAllPlayers().Count >= Main.Config.MinimumPlayers)
            {
                CommandWindow.Log("Enough players, attempting start");
                StartRound();
            }

            if (GetState() == RoundState.LIVE)
            {
                Round.Players.ToList().ForEach(p => InterfaceManager.SendUIEffectTextUnsafe(8490, p.SteamID, true, "TimerValue", ParseTime(Round.RoundTime)));

                Round.RoundTime--;

                if (GetAlivePlayersWithRole(PlayerRole.TRAITOR).Count == 0)
                {
                    CommandWindow.Log("Innocents win");
                    Round.Players.ToList().ForEach(p => Task.Run(async() => await InterfaceManager.SendBannerMessage(p.SteamID, 8493, "Innocents win!", 6000, true)));
                    await Round.Stop();

                    return;
                }

                if (GetAlivePlayersWithRole(PlayerRole.DETECTIVE).Count == 0 && RoundManager.GetAlivePlayersWithRole(PlayerRole.INNOCENT).Count == 0)
                {
                    CommandWindow.Log("Traitors win");
                    Round.Players.ToList().ForEach(p => Task.Run(async() => await InterfaceManager.SendBannerMessage(p.SteamID, 8492, "Traitors win!", 6000, true)));
                    await Round.Stop();

                    return;
                }
            }
        }
        private void NewCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(new CustomCommand(OverlayProgressBarItemModel.GoalReachedCommandName)));

            window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully;
            window.Show();
        }
Exemple #13
0
        public static void EnsureConfig(string path)
        {
            if (!File.Exists(path))
            {
                CommandWindow.Log("No TTTUnturned config found, generating...");

                JObject tttUnuturnedConfig = new JObject();
                tttUnuturnedConfig.Add("roundLength", 600);
                tttUnuturnedConfig.Add("debugMode", true);
                tttUnuturnedConfig.Add("minimumPlayers", 5);

                Spawn        exampleSpawn = new Spawn(0, 0, 0);
                List <Spawn> Spawns       = new List <Spawn>();
                Spawns.Add(exampleSpawn);
                tttUnuturnedConfig["lobbySpawns"] = JToken.FromObject(Spawns);

                Map        exampleMap = new Map("Example", Spawns);
                List <Map> Maps       = new List <Map>();
                Maps.Add(exampleMap);
                tttUnuturnedConfig["maps"] = JToken.FromObject(Maps);

                using (StreamWriter file = File.CreateText(path))
                    using (JsonTextWriter writer = new JsonTextWriter(file))
                    {
                        tttUnuturnedConfig.WriteTo(writer);
                        CommandWindow.Log("Generated TTTUnturned config");
                    }
            }
        }
Exemple #14
0
        public void initialize()
        {
            CommandWindow.Log("TTTUnturned loaded");

            UnityThread.initUnityThread();

            Patcher patch = new Patcher();

            Patcher.DoPatching();

            ConfigHelper.EnsureConfig($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}{Path.DirectorySeparatorChar}config.json");
            Config = ConfigHelper.ReadConfig($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}{Path.DirectorySeparatorChar}config.json");

            LevelSettings.SetConfig();
            //Level.onPostLevelLoaded += OnLevelLoaded;

            TTTUnturnedObject = new GameObject();
            var componentManagers = Assembly.GetExecutingAssembly().DefinedTypes
                                    .Where(type => type.ImplementedInterfaces.Any(inter => inter == typeof(IObjectComponent))).ToList();

            componentManagers.ForEach(c =>
            {
                MethodInfo methodInfo = typeof(GameObject).GetMethods()
                                        .Where(x => x.IsGenericMethod)
                                        .Where(x => x.Name == "AddComponent").Single();
                MethodInfo addComponentRef = methodInfo.MakeGenericMethod(c);
                addComponentRef.Invoke(TTTUnturnedObject, null);
            });
        }
Exemple #15
0
 public static void loadConfigData()
 {
     try {
         string configFile = @".\Modules\BubBuy\config.txt";
         if (System.IO.File.Exists(configFile))
         {
             string[] configData = System.IO.File.ReadAllLines(configFile);
             foreach (string str in configData)
             {
                 if (str.Length > 0 && str[0] != '#')
                 {
                     Match match = Regex.Match(str.Trim(), @"^([\.\w\d\s]+):(.+)", RegexOptions.IgnoreCase);
                     if (match.Success)
                     {
                         string option = match.Groups[1].Value.Trim();
                         string data   = match.Groups[2].Value.Trim();
                         if (option.Length > 0 && data.Length > 0)
                         {
                             parseConfigData(option, data);
                         }
                     }
                 }
             }
         }
         else
         {
             string[] str = { "# lines start with the sign # gonna be ignored", "# " };
             System.IO.File.WriteAllLines(configFile, str);
             CommandWindow.LogWarning("BubBuy Module: Can't find config file! auto-created empty config file.");
         }
     } catch (Exception e) {
         CommandWindow.LogError("BubBuy_error_PIN1005: exception3 got cought: " + e.Message);
     }
 }
        public static void AddLine(string message, ConsoleColor color)
        {
            try
            {
                if (IsReady && defaultIOHandlerOutputToConsoleMethodInfo != null && defaultIOHandler != null)
                {
                    defaultIOHandlerOutputToConsoleMethodInfo.Invoke(defaultIOHandler, new object[] { message, color });
                }
            } catch
            {
                switch (color)
                {
                case ConsoleColor.Gray:
                default:
                    CommandWindow.Log(message);
                    break;

                case ConsoleColor.Yellow:
                    CommandWindow.LogWarning(message);
                    break;

                case ConsoleColor.Red:
                    CommandWindow.LogError(message);
                    break;
                }
            }
        }
Exemple #17
0
        private void NewInteractiveCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new EventCommandDetailsControl(this.commandItem.EventType));

            window.Closed += Window_Closed;
            window.Show();
        }
Exemple #18
0
        public void initialize()
        {
            if (Dedicator.isDedicated)
            {
                rocketGameObject = new GameObject("Rocket");
                DontDestroyOnLoad(rocketGameObject);

                if (System.Environment.OSVersion.Platform == PlatformID.Unix || System.Environment.OSVersion.Platform == PlatformID.MacOSX)
#pragma warning disable CS0618
                {
                    Console = rocketGameObject.AddComponent <UnturnedConsole>();
                }
#pragma warning restore CS0618

                CommandWindow.Log("Rocket Unturned v" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " for Unturned v" + Provider.APP_VERSION);

                R.OnRockedInitialized += () =>
                {
                    Instance.Initialize();
                };

                Provider.onServerHosted += () =>
                {
                    rocketGameObject.TryAddComponent <U>();
                    rocketGameObject.TryAddComponent <R>();
                };
            }
        }
        private void AddUserOnlyCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new ChatCommandDetailsControl(autoAddToChatCommands: false));

            window.CommandSaveSuccessfully += NewUserOnlyCommandWindow_CommandSaveSuccessfully;
            window.Show();
        }
        public BasicTimerCommandEditorControl(CommandWindow window, BasicCommandTypeEnum commandType)
        {
            this.window      = window;
            this.commandType = commandType;

            InitializeComponent();
        }
        private void CommandButtons_EditClicked(object sender, RoutedEventArgs e)
        {
            CommandButtonsControl commandButtonsControl = (CommandButtonsControl)sender;
            InteractiveCommand    command = commandButtonsControl.GetCommandFromCommandButtons <InteractiveCommand>(sender);

            if (command != null)
            {
                CommandWindow window = null;
                if (command is InteractiveButtonCommand)
                {
                    window = new CommandWindow(new InteractiveButtonCommandDetailsControl(this.selectedGame, this.selectedGameVersion, (InteractiveButtonCommand)command));
                }
                else if (command is InteractiveJoystickCommand)
                {
                    window = new CommandWindow(new InteractiveJoystickCommandDetailsControl(this.selectedGame, this.selectedGameVersion, (InteractiveJoystickCommand)command));
                }
                else if (command is InteractiveTextBoxCommand)
                {
                    window = new CommandWindow(new InteractiveTextBoxCommandDetailsControl(this.selectedGame, this.selectedGameVersion, (InteractiveTextBoxCommand)command));
                }

                if (window != null)
                {
                    window.Closed += Window_Closed;
                    window.Show();
                }
            }
        }
        private void NewCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(new CustomCommand(OverlayStreamBossItemModel.NewStreamBossCommandName)));

            window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully;
            window.Show();
        }
Exemple #23
0
        private void AddCommandButton_Click(object sender, RoutedEventArgs e)
        {
            CommandWindow window = new CommandWindow(new ChatCommandDetailsControl());

            window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully;
            window.Show();
        }
Exemple #24
0
 public static void Schedule(string name, Func <Task> task, int interval, Action <Exception> exceptionHandler = null)
 {
     Task.Run(async() =>
     {
         try
         {
             while (true)
             {
                 await task();
                 await Task.Delay(interval);
             }
         }
         catch (Exception e)
         {
             if (exceptionHandler != null)
             {
                 exceptionHandler(e);
             }
             else
             {
                 CommandWindow.Log($"{e} Exception occured in task \"{name}\"\n");
             }
         }
     });
 }
        public void initialize(CommandWindow commandWindow)
        {
            if (m_IsAlive)
            {
                return;
            }

            var encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);

            System.Console.OutputEncoding = encoding;
            System.Console.InputEncoding  = encoding;

            m_PreviousConsoleIn = System.Console.In;

            var enableHistory      = m_Configuration.GetSection("console:history").Get <bool>();
            var enableAutoComplete = m_Configuration.GetSection("console:autocomplete").Get <bool>();

            m_ReadLineEnabled = enableHistory || enableAutoComplete;

            if (m_ReadLineEnabled)
            {
                ReadLine.HistoryEnabled        = enableHistory;
                ReadLine.AutoCompletionHandler = enableAutoComplete ?
                                                 m_AutoCompleteHandler : null;
            }

            m_IsAlive     = true;
            m_InputThread = new Thread(OnInputThreadStart)
            {
                IsBackground = true
            };

            m_InputThread.Start();
        }
Exemple #26
0
        public override void Execute()
        {
            DTE dte = GetService <DTE>(true);

            try
            {
                string websiteBasePath = GetBasePath();
                string url             = websiteBasePath + "\\" + _Url;

                if (AttachCurrentSelection)
                {
                    url += "#" + Helpers.GetSelectedType(dte);
                }

                Helpers.LogMessage(dte, this, "Opening page " + url);

                Window        win    = dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
                CommandWindow comwin = (CommandWindow)win.Object;
                comwin.SendInput("nav \"" + url + "\"", true);
            }
            catch (Exception ex)
            {
                Helpers.LogMessage(dte, this, ex.ToString());
            }
        }
Exemple #27
0
        protected override void execute(Steamworks.CSteamID executorID, string parameter)
        {
            // Dedicator.isDedicated?
            if (!Provider.isServer)
            {
                CommandWindow.LogError("You are not the server!");
                return;
            }
            Commands sys = UnturnedFreneticMod.Instance.CommandSystem.System;

            // TODO: FreneticScript Core methods to ease this.
            foreach (ScriptEvent evt in sys.Events.Values)
            {
                foreach (KeyValuePair <int, CommandScript> handl in new List <KeyValuePair <int, CommandScript> >(evt.Handlers))
                {
                    evt.RemoveEventHandler(handl.Value.Name);
                }
            }
            sys.Functions.Clear();
            for (int i = Commander.commands.Count - 1; i >= 0; i--)
            {
                if (Commander.commands[i] is UnturnedCustomCommand)
                {
                    Commander.commands.RemoveAt(i);
                }
            }
            UnturnedFreneticMod.Instance.PlayerCommands.Clear();
            UnturnedFreneticMod.Instance.AutorunScripts();
            SysConsole.Output(OutputType.INFO, "Reloaded succesfully!");
        }
Exemple #28
0
 private void LogDeath(string text)
 {
     if (Instance.Configuration.Instance.LogDeathMessages)
     {
         CommandWindow.Log(text);
     }
 }
        /// <summary>
        /// Handles the Help event of the task control.
        /// </summary>
        /// <param name="sender">The Task to parse for a guidance link.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void task_Help(object sender, EventArgs e)
        {
            Microsoft.VisualStudio.Shell.Task task = sender as Microsoft.VisualStudio.Shell.Task;

            if (task == null)
            {
                throw new ArgumentException("sender");
            }

            string url        = null;
            Match  urlMatches = Regex.Match(task.Text,
                                            @"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");

            if (urlMatches.Success)
            {
                url = urlMatches.Captures[0].Value;
            }

            if (url != null)
            {
                Window        win    = dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
                CommandWindow comwin = (CommandWindow)win.Object;
                comwin.SendInput("nav \"" + url + "\"", true);
            }
        }
        public void initialize()
        {
            CommandWindow.LogError($"Loaded UnturnedServerLink");

            UnityThread.initUnityThread();

            var patch = new Patcher();

            Patcher.DoPatching();

            var assembly   = _useLoader ? Assembly.GetCallingAssembly() : Assembly.GetExecutingAssembly();
            var dirName    = Path.GetDirectoryName(assembly.Location);
            var separator  = Path.DirectorySeparatorChar;
            var configPath = $"{dirName}{separator}config.json";

            ConfigHelper.EnsureConfig(configPath);
            Config = ConfigHelper.ReadConfig(configPath);

            _uslObject = new GameObject();
            var componentManagers = Assembly.GetExecutingAssembly().DefinedTypes
                                    .Where(type => type.ImplementedInterfaces.Any(inter => inter == typeof(IObjectComponent))).ToList();

            componentManagers.ForEach(c =>
            {
                var methodInfo = typeof(GameObject)
                                 .GetMethods()
                                 .Where(x => x.IsGenericMethod).Single(x => x.Name == "AddComponent");
                var addComponentRef = methodInfo.MakeGenericMethod(c);
                addComponentRef.Invoke(_uslObject, null);
            });

            ServerName = Provider.serverName;
        }