예제 #1
0
 internal void Awake()
 {
     Instance = this;
     Logger   = base.Logger;
     Harmony.CreateAndPatchAll(typeof(Hooks));
     GameAPI.RegisterExtraBehaviour <GameController>(GUID);
 }
예제 #2
0
        private void FindTargetCharacter()
        {
            _chaCtrl = MakerAPI.GetCharacterControl();
            if (_chaCtrl != null)
            {
                return;
            }

            var hFlag = FindObjectOfType <HFlag>();

            if (hFlag != null)
            {
                _chaCtrl = hFlag.player.chaCtrl;
            }
            if (_chaCtrl != null)
            {
                return;
            }

            _chaCtrl = GameAPI.GetCurrentHeroine()?.chaCtrl;
            if (_chaCtrl != null)
            {
                return;
            }

            // Fall back to brute search, prefer characters that aren't male and only run if we have a decent chance of getting the character that the player wants
            var chaControls = FindObjectsOfType <ChaControl>().Where(x => x.GetActiveTop() && x.visibleAll).ToArray();

            if (chaControls.Length < 4)
            {
                _chaCtrl = chaControls.OrderBy(x => x.sex > 0).FirstOrDefault();
            }
        }
예제 #3
0
        private void OpenChestH(object arg)
        {
            System.Random r     = new System.Random();
            int           coin  = r.Next(3 * monster.m_coin[m_level], 5 * monster.m_coin[m_level]);
            int           ocoin = r.Next(2 * monster.m_ocoin[m_level], 5 * monster.m_ocoin[m_level]);

            int collection = r.Next(0, (m_level + 1) * (GameData.collectItem.Count() / 5 + 1) > GameData.collectItem.Count() ? GameData.collectItem.Count() : (m_level + 1) * (GameData.collectItem.Count() / 5 + 1) + 1);

            GameControl.gameData.colloctions.Add(collection);
            //Debug.Log(collection);

            StringBuilder gain = new StringBuilder();

            gain.Append("<color=#FFD800>金币 * " + coin + "</color>\n<color=#FB00D4>灵石 * " + ocoin + "</color>\n<color=red>" + GameData.collectItem[collection].itemName + "</color>");
            var ud = AppConfig.Value.mainUserData;

            switch (GameControl.gameData.BOSSID)
            {
            case 12:
                if (!ud.stone[2] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 5)
                {
                    if (GameAPI.IsMeet(0.5f))
                    {
                        ud.stone[2] = true;
                        gain.Append("\n<color=#FA800A>人元石</color>");
                        GameControl.gameData.stone = 2;
                    }
                }
                break;

            case 13:
                if (!ud.stone[1] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 10)
                {
                    if (GameAPI.IsMeet(0.25f))
                    {
                        ud.stone[1] = true;
                        gain.Append("\n<color=#FA800A>地元石</color>");
                        GameControl.gameData.stone = 1;
                    }
                }
                break;

            case 14:
                if (!ud.stone[0] && ud.Statistics[GameData.Statist[(int)GameData.SID.ADVEN]] > 15)
                {
                    if (GameAPI.IsMeet(0.1f))
                    {
                        ud.stone[0] = true;
                        gain.Append("\n<color=#FA800A>天元石</color>");
                        GameControl.gameData.stone = 0;
                    }
                }
                break;
            }
            AppConfig.Value.mainUserData = ud;
            AppConfig.Save();
            UIAPI.ShowMsgBox("高级宝箱", gain.ToString(), "确定", Quit);
            GameControl.gameData.gainCoin  += coin;
            GameControl.gameData.gainOCoin += ocoin;
        }
예제 #4
0
        private Assembly TryLoadAssembly(string aAssembly)
        {
            try{
                var Result = Assembly.LoadFile(aAssembly);
                if (Result == null)
                {
                    return(Result);
                }
            }
            catch {}

            string CurrentDir = null;

            try
            {
                CurrentDir = Directory.GetCurrentDirectory();
                GameAPI.Console_Write($"Try load within: {CurrentDir} -> {Path.GetDirectoryName(aAssembly)}");
                Directory.SetCurrentDirectory(Path.GetDirectoryName(aAssembly));
                return(Assembly.LoadFile(aAssembly));
            }
            finally
            {
                Directory.SetCurrentDirectory(CurrentDir);
            }
        }
예제 #5
0
 public void PlaySpeech(LuaByteBuffer t)
 {
     if (t.buffer != null)
     {
         GameAPI.PlaySound(GetClip(t.buffer));
     }
 }
예제 #6
0
        public App()
        {
            InitializeComponent();

            IKernel kernel  = new StandardKernel();
            var     modules = new List <INinjectModule>
            {
                new GameModule()
            };

            kernel.Bind <StartPage>().ToSelf().InSingletonScope();
            kernel.Bind <INavigationService>().To <NavigationService>().InSingletonScope()
            .WithConstructorArgument("currentPage", kernel.Get <StartPage>());

            kernel.Bind <StartPageViewModel>().To <StartPageViewModel>();
            kernel.Bind <SinglePlayerPageViewModel>().To <SinglePlayerPageViewModel>();
            kernel.Load(modules);

            INavigationService navigation = kernel.Get <INavigationService>();

            navigation.InjectPage("StartPage", kernel.Get <StartPageViewModel>());
            navigation.InjectPage("SinglePlayerPage", kernel.Get <SinglePlayerPageViewModel>());

            api      = kernel.Get <GameAPI>();
            MainPage = new NavigationPage(kernel.Get <StartPage>());
            navigation.Navigate("StartPage");
        }
예제 #7
0
        private void LoadAssembly(string aFileName)
        {
            try
            {
                var ModFilename = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location), aFileName);

                GameAPI.Console_Write($"ModDispatcher: load {ModFilename}");
                var Mod     = Assembly.LoadFile(ModFilename);
                var ModType = Mod.GetTypes().Where(T => T.GetInterfaces().Contains(typeof(ModInterface))).FirstOrDefault();
                if (ModType != null)
                {
                    var ModInstance = Activator.CreateInstance(ModType) as ModInterface;
                    mModInstance.Add(ModInstance);
                    GameAPI.Console_Write($"ModDispatcher: loaded {ModFilename}");
                }
                else
                {
                    GameAPI.Console_Write($"ModDispatcher: no ModInterface class found");
                }
            }
            catch (ReflectionTypeLoadException Error)
            {
                GameAPI.Console_Write($"ModDispatcher: {aFileName} -> {Error}");
                Array.ForEach(Error.LoaderExceptions, E => GameAPI.Console_Write($"ModDispatcher: {aFileName} -> LE:{E}"));
            }
            catch (Exception Error)
            {
                GameAPI.Console_Write($"ModDispatcher: {aFileName} -> {Error}");
            }
        }
예제 #8
0
        static void Main()
        {
            try
            {
                var bots = new List <IBot>
                {
                    new MediumBot(),
                    new EasyBot()
                };

                var fieldFactory = new FieldFactory();
                var board        = new Board(7, 6, fieldFactory);
                var gameFactory  = new GameFactory(board, bots.ToArray());

                var playerFactory = new PlayerFactory();
                var proxy         = new GameProxy();

                var logger = new Log4netAdapter("GameAPI");
                var api    = new GameAPI(gameFactory, playerFactory, logger, proxy);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1(api));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MessageBox.Show(e.ToString());
                Application.Exit();
            }
        }
예제 #9
0
    public void StartRecord(LuaFunction fun, float maxTime)
    {
        if (mRecording)
        {
            return;
        }

        if (mLogin == false)
        {
            return;
        }

        YunVaImSDK.instance.RecordStopPlayRequest();
        GameAPI.PauseAllSound(true);

        UIAPI.DebugLog("开始录音");

                #if UNITY_EDITOR
        if (true)
        {
            return;
        }
                #endif

        endFun  = fun;
        clipCor = StartCoroutine(OnTimeOut(maxTime));

        mRecording = true;
        string filePath = string.Format("{0}/{1}.amr", Application.persistentDataPath, DateTime.Now.ToFileTime());
        YunVaImSDK.instance.RecordStartRequest(filePath);
    }
예제 #10
0
        public static async Task ChangeNewMemberName(string id, ApplyEventArgs e)
        {
            //直接绑定
            GameAPI data = new GameAPI(e.EventArgs.FromGroup, e.EventArgs.FromQQ, e.Session);

            data.Member.ClanData = new List <ClanData>();
            ICocCorePlayers players = Instance.container.Resolve <ICocCorePlayers>();
            var             player  = players.GetPlayer(id);
            var             newname = Instance.THLevels[player.TownHallLevel] + "本-" + player.Name;
            var             cdata   = new ClanData()
            {
                ClanID = id, Name = player.Name
            };

            try
            {
                if (valuePairs(configType.部落冲突)[e.EventArgs.FromGroup.ToString()] == player.Clan.Tag)
                {
                    cdata.InClan         = true;
                    cdata.LastSeenInClan = DateTime.Now;
                }
            }
            catch
            {
                //Ignore if not found clan ID
            }
            data.Member.ClanData.Add(cdata);
            data.Dispose();
            await e.Session.ChangeGroupMemberInfoAsync(e.EventArgs.FromQQ, e.EventArgs.FromGroup, new GroupMemberCardInfo(newname, null));

            await e.Session.SendGroupMessageAsync(e.EventArgs.FromGroup, new AtMessage(e.EventArgs.FromQQ), new PlainMessage("新人看群文件部落规则,违反任何一条都将会被机票!已经自动绑定成功为" + newname));

            await e.Session.SendGroupMessageAsync(e.EventArgs.FromGroup, new PlainMessage(id));
        }
예제 #11
0
    static int FindObj(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.GameObject o = GameAPI.FindObj(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(string)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                UnityEngine.GameObject o = GameAPI.FindObj(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: GameAPI.FindObj"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #12
0
    void Start()
    {
        GameAPI.ResetGameAPI();

        bgMusic = GetComponent <AudioSource>();

        mainCamera = GameObject.Find("Main Camera")?.transform;

        if (PlayerPrefs.HasKey("gamePath"))
        {
            Debug.Log("Game path was detected: " + PlayerPrefs.GetString("gamePath"));

            if (!GameAPI.instance.SetGamePath(PlayerPrefs.GetString("gamePath")))
            {
                PathSelectionMenu();
            }
            else
            {
                SetupDefaultBackground();
            }
        }
        else
        {
            PathSelectionMenu();
        }

        CommandTerminal.Terminal.Shell.AddCommand("rgpnow", (CommandTerminal.CommandArg[] args) => {
            PlayerPrefs.DeleteKey("gamePath");
            PlayerPrefs.Save();
            Debug.Log("Game path was removed from PlayerPrefs!");
        }, 0, 0, "Resets the game path in PlayerPrefs");

        gameVersion.text = GameAPI.GAME_VERSION;
        buildTime.text   = string.Format("Build Time: {0}", BuildInfo.BuildTime());
    }
예제 #13
0
        public static void OnInsideFinish(HFlag __instance)
        {
            try
            {
                if (__instance.player != null)
                {
                    var heroine      = __instance.GetLeadingHeroine();
                    var currentCrest = heroine.GetCurrentCrest();
                    if (currentCrest == CrestType.siphoning)
                    {
#if KK
                        __instance.player.physical  = Mathf.Min(100, __instance.player.physical + 15);
                        __instance.player.intellect = Mathf.Min(100, __instance.player.intellect + 10);
                        __instance.player.hentai    = Mathf.Min(100, __instance.player.hentai + 5);
#elif KKS
                        __instance.player.koikatsuPoint += 10;
#endif
                        // 22 is sleep
                        GameAPI.GetActionControl()?.AddDesire(22, heroine, 35);
                    }
                }
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError(e);
            }
        }
        private void HandleModCommunication(ModComData msg)
        {
            if (OutServer == null)
            {
                return;
            }

            try
            {
                switch (msg.Command)
                {
                case ModCommand.GetPathFor: OutServer.SendMessage(new ModComData()
                    {
                        Command = msg.Command, SequenceId = msg.SequenceId, Data = ModAPI.Application.GetPathFor((AppFolder)msg.Data)
                    }); break;

                case ModCommand.PlayfieldDataReceived:
                {
                    var data = msg.Data as PlayfieldNetworkData;
                    ModAPI.Network.SendToPlayfieldServer(data.Sender, data.PlayfieldName, data.Data);
                    break;
                }
                }
            }
            catch (System.Exception Error)
            {
                GameAPI.Console_Write($"ModClientDll: {Error.Message}");
            }
        }
예제 #15
0
        public bool addNewUser(string connectionId, string nickName)
        {
            bool nickNameTaken = GameAPI.containsKey(nickName);

            Console.WriteLine("Nickname taken bool" + nickNameTaken);

            if (!nickNameTaken)
            {
                GameAPI.addPlayer(nickName, connectionId);
            }
            ;

            Console.WriteLine("key in gameAPI: " + GameAPI.containsKey(nickName));


            Console.WriteLine(GameAPI.getPlayerConnectionID(nickName));
            Console.WriteLine(nickName);

            Console.WriteLine("Players joined: ");
            foreach (String name in GameAPI.getPlayerNames())
            {
                Console.WriteLine(name);
            }
            ;

            return(nickNameTaken);
        }
예제 #16
0
 public async Task SendGameState()
 {
     if (GameAPI.getGameState() != null)
     {
         await Clients.All.SendAsync("sendGameState", JsonProcessor.getWerewolfJson(GameAPI.getGameState()));
     }
 }
예제 #17
0
    public static void Handle_chat_message(ChatInfo data)
    {
        AlertMessage($"chat message {data.type}");
        GameAPI.Console_Write($"chat message {data.type}");
        if (data.type != 3)
        {
            return;
        }
        var handled = false;


        foreach (var item in chatCommandActions)
        {
            var r     = new Regex(item.Key);
            var match = r.Match(data.msg);

            if (!match.Success)
            {
                continue;
            }

            var content = match.Groups.Count > 0 ? match.Groups[1].ToString() : "";
            item.Value.Invoke(new PString(content));
            handled = true;
        }
    }
        private void Start()
        {
            PregnancyProgressionSpeed = Config.Bind("General", "Pregnancy progression speed", 4,
                                                    new ConfigDescription("How much faster does the in-game pregnancy progresses than the standard 40 weeks. " +
                                                                          "It also reduces the time characters leave school for after birth.\n\n" +
                                                                          "x1 is 40 weeks, x2 is 20 weeks, x4 is 10 weeks, x10 is 4 weeks.",
                                                                          new AcceptableValueList <int>(1, 2, 4, 10)));

            ConceptionEnabled = Config.Bind("General", "Enable conception", true,
                                            "Allows characters to get pregnant from vaginal sex. Doesn't affect already pregnant characters.");

            AnalConceptionEnabled = Config.Bind("General", "Enable anal conception", false,
                                                "Allows characters to get pregnant from anal sex. Doesn't affect already pregnant characters.");

            ShowPregnancyIconEarly = Config.Bind("General", "Show pregnancy icon early", false,
                                                 "By default pregnancy status icon in class roster is shown after a few days (the girl had a chance to do the test). " +
                                                 "Turning this on will make the icon show up at the end of the current day.");

            CharacterApi.RegisterExtraBehaviour <PregnancyCharaController>(GUID);
            GameAPI.RegisterExtraBehaviour <PregnancyGameController>(GUID);

            var hi = new Harmony(GUID);

            Hooks.InitHooks(hi);
            PregnancyGui.Init(hi, this);
        }
예제 #19
0
        internal string AddItem(Element element, long price, int amount, GameAPI owner)
        {
            if (amount < 0 || price < 0)
            {
                return("你卖个寂寞?");
            }
            if (!owner.Member.Inventory.Any(x => x.Element.Name == element.Name && x.ContainsCount >= amount))
            {
                return("你没有足够数量的商品贩卖!");
            }
            if (price > 99999)
            {
                return("商场拒收如此贵重的物品!请把价格调低!");
            }
            owner.Member.Inventory.First(x => x.Element.Name == element.Name).ContainsCount -= amount;
            var newitem = new TradeItem
            {
                UniqueId = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "").Substring(0, 8).ToUpper(),
                Item     = element,
                Owner    = owner.Member,
                Price    = price,
                Amount   = amount
            };

            tradeItems.Add(newitem);
            return("商品已经上架!");
        }
        public void Game_Exit()
        {
            Exit = true;
            GameAPI.Console_Write($"ModClientDll: Game_Exit {CurrentConfig.Current.ModToEmpyrionPipeName}");
            OutServer?.SendMessage(new ClientHostComData()
            {
                Command = ClientHostCommand.Game_Exit
            });

            if (!ExposeShutdownHost && CurrentConfig.Current.AutoshutdownModHost && mHostProcess != null)
            {
                try
                {
                    try { mHostProcess.CloseMainWindow(); } catch { }
                    CurrentConfig.Current.HostProcessId = 0;
                    CurrentConfig.Save();

                    Thread.Sleep(1000);
                }
                catch (Exception Error)
                {
                    GameAPI.Console_Write($"ModClientDll: Game_Exit {Error}");
                }
            }

            InServer?.Close();
            OutServer?.Close();
        }
예제 #21
0
    public void StopSpeech()
    {
        if (clipCor != null)
        {
            StopCoroutine(clipCor);
            clipCor = null;
        }

        Microphone.End(null);

        GameAPI.PauseAllSound(false);

        if (onClipEnd != null)
        {
            onClipEnd.BeginPCall();
            if (clip != null)
            {
                byte[]        buf = GetClipData();
                LuaByteBuffer l   = new LuaByteBuffer(buf);
                onClipEnd.Push(l);
            }
            onClipEnd.PCall();
            onClipEnd.EndPCall();

            onClipEnd = null;
        }
    }
        private void CreateHostProcess(string HostFilename)
        {
            try
            {
                mHostProcess = new Process
                {
                    StartInfo = new ProcessStartInfo(HostFilename)
                    {
                        UseShellExecute  = CurrentConfig.Current.WithShellWindow,
                        CreateNoWindow   = true,
                        WorkingDirectory = ProgramPath,
                        Arguments        = Environment.GetCommandLineArgs().Aggregate(
                            $"-EmpyrionToModPipe {CurrentConfig.Current.EmpyrionToModPipeName} -ModToEmpyrionPipe {CurrentConfig.Current.ModToEmpyrionPipeName}",
                            (C, A) => C + " " + A),
                    }
                };

                mHostProcess.Start();
                CurrentConfig.Current.HostProcessId = mHostProcess.Id;
                GameAPI.Console_Write($"ModClientDll: host started '{HostFilename}/{mHostProcess.Id}'");
            }
            catch (Exception Error)
            {
                GameAPI.Console_Write($"ModClientDll: host start error '{HostFilename} -> {Error}'");
                mHostProcess = null;
            }
        }
예제 #23
0
        internal void Start()
        {
            Logger = base.Logger;
            VRControllerColliderHelper.pluginInstance = this;

            PluginConfigInit();

            //Get VR flags
            bool noVrFlag = Environment.CommandLine.Contains("--novr");

            VREnabled = !noVrFlag && SteamVRDetector.IsRunning;

            if (VRPlugin.debugLog)
            {
                VRPlugin.Logger.LogInfo($" VREnabled {VREnabled}");
            }

            //IF not VR dont bother with VR hooks
            if (!VREnabled)
            {
                return;
            }

            //Set up game mode detectors to start certain logic when loading into main game
            GameAPI.RegisterExtraBehaviour <VRControllerGameController>(GUID + "_controller");

            //Harmony init.  It's magic!
        }
예제 #24
0
    static int PlaySound(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AudioClip)))
            {
                UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.ToObject(L, 1);
                GameAPI.PlaySound(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int)))
            {
                string arg0 = ToLua.ToString(L, 1);
                int    arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                GameAPI.PlaySound(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: GameAPI.PlaySound"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #25
0
    public object Clone()
    {
        GameAPI api = new GameAPI();

        api.DBID       = this.DBID;
        api.ReturnType = this.ReturnType;
        api.strText    = this.strText;
        api.isAsyn     = this.isAsyn;
        api.strTip     = this.strTip;
        api.strName    = this.strName;
        api.combText   = this.combText;
        api.ArgList    = this.ArgList;
        for (int i = 0; i < this.ArgList.Length; i++)
        {
            if (i < this.ArgValues.Count && this.ArgValues[i] != null)
            {
                api.ArgValues.Add(this.ArgValues[i].Clone() as Exp);
            }
            else
            {
                api.ArgValues.Add(null as Exp);
            }
        }
        return(api);
    }
        private void Start()
        {
            if (!StudioAPI.InsideStudio)
            {
                EnableBld                = new ConfigWrapper <bool>(nameof(EnableBld), this, true);
                EnableBldAlways          = new ConfigWrapper <bool>(nameof(EnableBldAlways), this, false);
                EnableCum                = new ConfigWrapper <bool>(nameof(EnableCum), this, true);
                EnableSwt                = new ConfigWrapper <bool>(nameof(EnableSwt), this, true);
                EnableTear               = new ConfigWrapper <bool>(nameof(EnableTear), this, true);
                EnableDrl                = new ConfigWrapper <bool>(nameof(EnableDrl), this, true);
                EnablePersistance        = new ConfigWrapper <bool>(nameof(EnablePersistance), this, true);
                EnableClothesPersistance = new ConfigWrapper <bool>(nameof(EnableClothesPersistance), this, true);

                SceneManager.sceneLoaded += (scene, mode) =>
                {
                    // Preload effects for H scene in case they didn't get loaded yet to prevent freeze on first effect appearing
                    if (scene.name == "H")
                    {
                        TextureLoader.InitializeTextures();
                    }
                };
            }

            Hooks.InstallHooks();

            CharacterApi.RegisterExtraBehaviour <SkinEffectsController>(GUID);
            GameAPI.RegisterExtraBehaviour <SkinEffectGameController>(GUID);

            SkinEffectsGui.Init(this);
        }
예제 #27
0
    public override bool Equals(object obj)
    {
        if (obj == null)
        {
            return(false);
        }
        if (!(obj is GameAPI))
        {
            return(false);
        }
        GameAPI api = obj as GameAPI;

        if (this.ArgValues.Count != api.ArgValues.Count)
        {
            return(false);
        }
        for (int i = 0; i < this.ArgValues.Count; i++)
        {
            if (this.ArgValues[i] == null && api.ArgValues[i] == null)
            {
                continue;
            }
            if (this.ArgValues[i] == null || api.ArgValues[i] == null)
            {
                return(false);
            }
            if (!this.ArgValues[i].Equals(api.ArgValues[i]))
            {
                return(false);
            }
        }
        return(this.DBID.Equals(api.DBID));
    }
예제 #28
0
    public void StopRecord()
    {
                #if UNITY_EDITOR
        if (true)
        {
            return;
        }
                #endif

        if (mLogin == false)
        {
            return;
        }

        GameAPI.PauseAllSound(false);

        UIAPI.DebugLog("结束录音");

        if (clipCor != null)
        {
            StopCoroutine(clipCor);
            clipCor = null;
        }

        YunVaImSDK.instance.RecordStopRequest(StopRecordResponse);
    }
예제 #29
0
        private void StartHostProcess()
        {
            var HostFilename = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location), CurrentConfig.Current.PathToModHost);

            GameAPI.Console_Write($"ModClientDll: start host '{HostFilename}'");
            mHostProcessAlive = null;

            if (CurrentConfig.Current.HostProcessId != 0)
            {
                try
                {
                    mHostProcess = Process.GetProcessById(CurrentConfig.Current.HostProcessId);
                    if (mHostProcess.MainWindowTitle != HostFilename)
                    {
                        mHostProcess = null;
                    }
                }
                catch (Exception)
                {
                    mHostProcess = null;
                }
            }

            if (mHostProcess == null && CurrentConfig.Current.AutostartModHost && !string.IsNullOrEmpty(CurrentConfig.Current.PathToModHost))
            {
                if (!ExistsStopFile())
                {
                    CreateHostProcess(HostFilename);
                }
            }
        }
예제 #30
0
        private void CheckForBinCopyFile()
        {
            if (string.IsNullOrEmpty(CurrentConfig.Current.PathToModHost))
            {
                return;
            }

            var BinHostFilename = Path.Combine(Path.Combine(
                                                   Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location),
                                                   Path.GetDirectoryName(CurrentConfig.Current.PathToModHost)),
                                               Path.GetFileNameWithoutExtension(CurrentConfig.Current.PathToModHost) + ".bin"
                                               );

            var HostFilename = Path.Combine(
                Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location),
                CurrentConfig.Current.PathToModHost);

            if (!File.Exists(BinHostFilename))
            {
                return;
            }

            try{ File.Delete(HostFilename); }
            catch (Exception Error) { GameAPI.Console_Write($"CheckForBinCopyFile: delete {HostFilename} => {Error}"); }

            try { File.Move(BinHostFilename, HostFilename); }
            catch (Exception Error) { GameAPI.Console_Write($"CheckForBinCopyFile: move {BinHostFilename} -> {HostFilename} => {Error}"); }
        }
예제 #31
0
        /// <summary>Обработчик Столкновений</summary>
        static void Collision(GameAPI.GameMap map, GameAPI.Point p, Object NewObj, Object ExistObj)
        {
            if ((NewObj is GameAPI.Snake) && (ExistObj is GameAPI.Mouse))
            {
                //Удалим яблочко
                map.Remove(p);
                (NewObj as Snake).Grow(map); // Вырастим

                if ((NewObj as Snake).Count >= 12) throw new GameWinExeption(); //Віиграли

                RandomAppleGeneration(); // Сгенерим новое яблочко
            }
            else
               throw new GameOverExeption();
        }