Пример #1
0
 // Use this for initialization
 void Start()
 {
     Help    = FindObjectOfType(typeof(OnHelp)) as OnHelp;
     Setting = FindObjectOfType(typeof(OnSettings)) as OnSettings;
     FB      = FindObjectOfType(typeof(OnFb)) as OnFb;
     cup     = FindObjectOfType(typeof(OnCup)) as OnCup;
 }
Пример #2
0
        bool IPropertyManagerPage2Handler9.OnHelp()
        {
            if (OnHelp.IsRef())
            {
                OnHelp();
            }

            return(true);
        }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        Help = FindObjectOfType(typeof(OnHelp)) as OnHelp;
        FB   = FindObjectOfType(typeof(OnFb)) as OnFb;
        cup  = FindObjectOfType(typeof(OnCup)) as OnCup;
        AudioSource audioSource = UnityEngine.Object.FindObjectOfType <AudioSource>();

        sound_dropdown.value = PlayerPrefs.GetInt("MancalaSound", 1);
        if (PlayerPrefs.GetInt("MancalaSound", 1) == 1)
        {
            audioSource.UnPause();
        }
        else
        {
            audioSource.Pause();
        }
    }
        public void DoWork(string[] args)
        {
            var dict            = GetDictionary(args);
            var commandArgument = Parse(dict);

            #region 判断是否cmd打开
            var hWnd = GetConsoleWindow();
            GetWindowThreadProcessId(hWnd, out int processId);
            Process process = Process.GetProcessById(processId);
            commandArgument.IsCmdOpen = process.ProcessName.ToLower() == "cmd";
            if (args.Length == 0 && commandArgument.IsCmdOpen == false)
            {
                commandArgument.Help = true;
            }
            #endregion


            var name = _name;
            if (string.IsNullOrEmpty(commandArgument.Name) == false)
            {
                name = name + "-" + commandArgument.Name;
            }


            if (commandArgument.Help)
            {
                OnHelp?.Invoke(this, new ServerNameEventArgs(name, args, dict, commandArgument));
            }
            else if (commandArgument.Start)
            {
                if (commandArgument.Hidden)
                {
                    ShowWindow(GetConsoleWindow(), SW_HIDE);
                }
                OnStart?.Invoke(this, new ServerNameEventArgs(name, args, dict, commandArgument));
                server = new PipeServer(name);
                server.OnReceiveContent += Server_OnReceiveContent;
                server.Start().Wait();
            }
            else
            {
                if (commandArgument.Show)
                {
                    Send(name, "-show").Wait();
                }
                if (commandArgument.Hidden)
                {
                    Send(name, "-hide").Wait();
                }
                if (commandArgument.Stop)
                {
                    Send(name, "-stop").Wait();
                }
                else if (commandArgument.Pause)
                {
                    Send(name, "-pause").Wait();
                }
                else if (commandArgument.Continue)
                {
                    Send(name, "-continue").Wait();
                }
                else if (string.IsNullOrEmpty(commandArgument.Command) == false)
                {
                    Send(name, "-command " + commandArgument.Command).Wait();
                }
            }
        }