public StatusMessage StartGame(int id, bool install = false)
        {
            StatusMessage returnMessage = new StatusMessage();

            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];
            string secretKey   = ConfigurationManager.AppSettings["Secret"];

            encryption = new Encryption(secretKey);

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            returnMessage.message = game.message;
            returnMessage.status  = game.status;

            if (game.status == "ok")
            {
                game.password          = encryption.Decrypt(game.password);
                LauncherInfo.isInstall = install;
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(returnMessage);
        }
        internal void LoadSettings()
        {
            var compModel      = PythonToolsPackage.ComponentModel;
            var launchers      = compModel.GetExtensions <IPythonLauncherProvider>();
            var launchProvider = _propPage.Project.GetProjectProperty(PythonConstants.LaunchProvider, false);

            if (String.IsNullOrWhiteSpace(launchProvider))
            {
                launchProvider = DefaultLauncherProvider.DefaultLauncherDescription;
            }

            foreach (var launcher in launchers)
            {
                var launchInfo = new LauncherInfo((PythonProjectNode)_propPage.Project, launcher);
                launchInfo.LauncherOptions.DirtyChanged += LauncherOptionsDirtyChanged;
                _launchers.Add(launchInfo);
                this._launchModeCombo.Items.Add(launcher.Name);

                if (launcher.Name == launchProvider)
                {
                    _launchModeCombo.SelectedIndexChanged -= LaunchModeComboSelectedIndexChanged;
                    _launchModeCombo.SelectedIndex         = _launchModeCombo.Items.Count - 1;
                    _launchModeCombo.SelectedIndexChanged += LaunchModeComboSelectedIndexChanged;
                    _debuggerToolTip.SetToolTip(_launchModeCombo, launcher.Description);

                    SwitchLauncher(launchInfo);
                }
            }
        }
 public LauncherModifier(LauncherInfo launcherInfo, Vector3 collidedProjectilePosition,
                         Vector3 collidedProjectileVelocity, Entity caster, Entity target,
                         Camera camera, SkillId skillId, Environment environment,
                         CollectionOfInteractions modifierInteractionCollection,
                         WallHitConfig whc, float damageScale) : base(launcherInfo, collidedProjectilePosition, collidedProjectileVelocity, caster, target, camera, skillId, environment, modifierInteractionCollection, whc, damageScale)
 {
     this.launcherInfo = launcherInfo;
 }
        public string Checkin()
        {
            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];

            string URL = $"{baseURL}/game/checkin";

            gc.CheckinUser(URL, computerKey);
            LauncherInfo.StopGame();
            return("ok");
        }
Exemple #5
0
    private void Start()
    {
        var arr = LauncherInfoFactory.Instance.LauncherInfoArray;

        info = Array.Find(arr, launchInfo => launchInfo.id == Id);
        if (info == null)
        {
            throw new Exception(string.Format("不存在ID={0}的配置", Id));
        }
        StartCoroutine(StartTimer());
    }
        public string StartGame(int id)
        {
            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            if (game.status == "ok")
            {
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(game.status);
        }
        private void SwitchLauncher(LauncherInfo info)
        {
            var newLauncher = info.OptionsControl;

            info.LauncherOptions.LoadSettings();

            if (_curLauncher != null)
            {
                this.Controls.Remove(_curLauncher);
            }

            Controls.Add(newLauncher);
            newLauncher.Location = new Point(11, 48);
            _curLauncher         = newLauncher;
            _debuggerToolTip.SetToolTip(_launchModeCombo, info.Launcher.Description);
        }
Exemple #8
0
    /// <summary>
    /// 弾生成
    /// </summary>
    protected void BulletInstantiate(LauncherInfo l)
    {
        //生成
        var b = (GameObject)Instantiate(l.bullet);

        b.transform.position    = l.bullet.transform.position;
        b.transform.eulerAngles = l.bullet.transform.eulerAngles;
        //アクティブ化
        if (b.activeInHierarchy == false)
        {
            b.SetActive(true);
        }
        //名前とタグ
        b.name = bulletName;
        b.tag  = bulletTag;

        //Bulletコンポーネントを取得する
        var bullet = b.GetComponent <Bullet>();

        bullet.SetParameter(gameObject, l.launcher.totalPerformance.velocity, l.launcher.totalPerformance.damage, l.launcher.barrelBonus, l.launcher.caliberBonus, symbolColor);
    }
Exemple #9
0
        internal void LoadSettings()
        {
            var compModel      = _propPage.Project.Site.GetComponentModel();
            var launchProvider = _propPage.Project.GetProjectProperty(PythonConstants.LaunchProvider, false);

            if (String.IsNullOrWhiteSpace(launchProvider))
            {
                launchProvider = DefaultLauncherProvider.DefaultLauncherName;
            }

            _launchModeCombo.SelectedIndexChanged -= LaunchModeComboSelectedIndexChanged;

            LauncherInfo currentInfo = null;
            var          projectNode = (PythonProjectNode)_propPage.Project;

            foreach (var info in compModel.GetExtensions <IPythonLauncherProvider>()
                     .Select(i => new LauncherInfo(projectNode, i))
                     .OrderBy(i => i.SortKey))
            {
                info.LauncherOptions.DirtyChanged += LauncherOptionsDirtyChanged;
                _launchModeCombo.Items.Add(info);
                if (info.Launcher.Name == launchProvider)
                {
                    currentInfo = info;
                }
            }

            if (currentInfo != null)
            {
                _launchModeCombo.SelectedItem = currentInfo;
                SwitchLauncher(currentInfo);
            }
            else
            {
                _launchModeCombo.SelectedIndex = -1;
                SwitchLauncher(null);
            }

            _launchModeCombo.SelectedIndexChanged += LaunchModeComboSelectedIndexChanged;
        }
Exemple #10
0
        public StatusMessage StartGame(int id, bool install = false)
        {
            StatusMessage returnMessage = new StatusMessage();

            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];
            string secretKey   = ConfigurationManager.AppSettings["Secret"];

            // We must decrypt the secret key using the machine key
            //machineKeyEncryption = new Encryption("the machine key");
            try
            {
                secretKey = MachineKeyEncryption.UnProtect(secretKey, $"Secret for computer {computerKey}");
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error: Unable to load settings. Contact an administrator.\n\n{e.Message}");
                throw;
            }

            // Then, we can Encrypt/Decrypt using that decrypted secret key
            encryption = new Encryption(secretKey);

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            returnMessage.message = game.message;
            returnMessage.status  = game.status;

            if (game.status == "ok")
            {
                game.password          = encryption.Decrypt(game.password);
                LauncherInfo.isInstall = install;
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(returnMessage);
        }
Exemple #11
0
        private void SwitchLauncher(LauncherInfo info)
        {
            if (_curLauncher != null)
            {
                tableLayout.Controls.Remove(_curLauncher);
            }

            if (info == null)
            {
                _curLauncher = null;
                _debuggerToolTip.SetToolTip(_launchModeCombo, null);
                return;
            }

            var newLauncher = info.OptionsControl;

            info.LauncherOptions.LoadSettings();
            tableLayout.Controls.Add(newLauncher);
            tableLayout.SetCellPosition(newLauncher, new TableLayoutPanelCellPosition(0, 1));
            tableLayout.SetColumnSpan(newLauncher, 2);
            newLauncher.Dock = DockStyle.Fill;
            _curLauncher     = newLauncher;
            _debuggerToolTip.SetToolTip(_launchModeCombo, info.Launcher.Description);
        }
    private static System.Collections.IEnumerator OnNewInit(object objd)
    {
        Object obj = ResManager.Instance.LoadObject("ServerSetting", "GlobalRes/ServerSetting/", ResType.GlobalRes, typeof(TextAsset));

        if (obj == null)
        {
            InitLogic.SetInitFailed();
            yield break;
        }
        TextAsset   ta  = obj as TextAsset;
        XmlDocument doc = new XmlDocument();

        doc.LoadXml(ta.text);
        XmlNode pConfig = doc.SelectSingleNode("Config");

        XmlNode verNode    = pConfig.SelectSingleNode("ServerVersion");
        XmlNode comboNode  = pConfig.SelectSingleNode("Combo");
        XmlNode energyNode = pConfig.SelectSingleNode("Energy");
        XmlNode cannonNode = pConfig.SelectSingleNode("Cannon");
        XmlNode skillNode  = pConfig.SelectSingleNode("Skill");
        XmlNode rateNode   = pConfig.SelectSingleNode("Rate");
        XmlNode fishNode   = pConfig.SelectSingleNode("Fish");
        XmlNode rankNode   = pConfig.SelectSingleNode("Rank");
        XmlNode dstNode    = pConfig.SelectSingleNode("FishDeadTime");

        if (verNode == null ||
            comboNode == null ||
            energyNode == null ||
            skillNode == null ||
            rateNode == null ||
            cannonNode == null ||
            fishNode == null ||
            rankNode == null ||
            dstNode == null)
        {
            LogMgr.Log("ServerSetting load failed.");
            InitLogic.SetInitFailed();
            yield break;
        }
        if (energyNode.ChildNodes.Count != cannonNode.ChildNodes.Count)
        {
            LogMgr.Log("energyNode<>cannonNode");
            InitLogic.SetInitFailed();
            yield break;
        }
        int nFishs      = 0;
        int nFishValues = 0;

        LauncherInfo [] plauncherinfo;


        yield return(new WaitForEndOfFrame());

        Attribute(verNode, "wonderful_base", ref ExtraSetting.WonderFulBase);
        /////Ver
        //Attribute(verNode, "maxfish", ref FishSetting.FISH_MAX_NUM);
        //Attribute(verNode, "maxbullet", ref BulletSetting.BULLET_MAX_NUM);

        /////Combo
        Attribute(comboNode, "sustain_time", ref DoubleHit.IntervalTime);
        Attribute(comboNode, "buff_cycle", ref DoubleHit.MaxTimes);

        ////Cannon
        int launcherCount = energyNode.ChildNodes.Count;

        plauncherinfo = new LauncherInfo[launcherCount];
        LauncherSetting.LauncherDataList = new LauncherData[launcherCount];
        for (int i = 0; i < launcherCount; ++i)//from energy
        {
            LauncherData ld = new LauncherData();

            XmlNode node = energyNode.ChildNodes[i];
            Attribute(node, "id", ref ld.ID);
            Attribute(node, "cditme", ref ld.LaserCDTime);
            Attribute(node, "speed", ref ld.LaserReduction.Speed);
            Attribute(node, "time1", ref ld.LaserReduction.Duration1);
            Attribute(node, "time2", ref ld.LaserReduction.Duration2);
            Attribute(node, "time3", ref ld.LaserReduction.Duration3);

            LauncherInfo Item = new LauncherInfo();
            Attribute(node, "mincatch", ref Item.nmincatch);
            Attribute(node, "maxcatch", ref Item.nmaxcatch);
            Attribute(node, "revise", ref Item.nrevise);
            Attribute(node, "energyratio", ref Item.denergyratio);



            if (LauncherSetting.LauncherDataList[ld.ID] != null)
            {
                LogMgr.Log("Exist the same launcher id.");
                InitLogic.SetInitFailed();
                yield break;
            }
            LauncherSetting.LauncherDataList[ld.ID] = ld;
            plauncherinfo[ld.ID] = Item;
        }
        yield return(new WaitForEndOfFrame());

        for (int i = 0; i < launcherCount; ++i)//from cannon
        {
            XmlNode node = cannonNode.ChildNodes[i];
            byte    byid = 0;
            Attribute(node, "id", ref byid);
            LauncherData ld = LauncherSetting.LauncherDataList[byid];

            ld.name = node.Attributes["name"].Value;
            Attribute(node, "launcherinterval", ref ld.Interval);
            Attribute(node, "consume", ref ld.Consume);
            Attribute(node, "bulletspeed", ref ld.Speed);
            Attribute(node, "itemid", ref ld.nItemid);
            Attribute(node, "itemcount", ref ld.nItemcount);
            Attribute(node, "skill", ref ld.nSkillBind);

            if (byid == (byte)LauncherType.LAUNCHER_4)//4号炮特有
            {
                Attribute(node, "speed", ref BulletSetting.FreezeBulletReduction.Speed);
                Attribute(node, "time1", ref BulletSetting.FreezeBulletReduction.Duration1);
                Attribute(node, "time2", ref BulletSetting.FreezeBulletReduction.Duration2);
                Attribute(node, "time3", ref BulletSetting.FreezeBulletReduction.Duration3);
            }
        }
        yield return(new WaitForEndOfFrame());

        /////SkillInfo
        int skillCount = skillNode.ChildNodes.Count;

        SkillSetting.SkillDataList = new SkillData[skillCount];
        for (int i = 0; i < skillCount; ++i)
        {
            SkillData sd   = new SkillData();
            XmlNode   node = skillNode.ChildNodes[i];
            Attribute(node, "id", ref sd.ID);
            sd.name = node.Attributes["name"].Value;
            Attribute(node, "cditme", ref sd.CDTime);
            Attribute(node, "goodsid", ref sd.ItemId);
            Attribute(node, "multiple", ref sd.multiple);
            Attribute(node, "speed", ref sd.Reduction.Speed);
            Attribute(node, "time1", ref sd.Reduction.Duration1);
            Attribute(node, "time2", ref sd.Reduction.Duration2);
            Attribute(node, "time3", ref sd.Reduction.Duration3);

            string szInfo = "";
            Attribute(node, "goodsconsume", ref szInfo);
            if (szInfo.Length > 0)
            {
                string[] pConsume = szInfo.Split(' ');
                for (int index = 0; index < pConsume.Length; index += 2)
                {
                    SkillConsume pskill = new SkillConsume();
                    pskill.byorder = System.Convert.ToByte(pConsume[index]);
                    pskill.byCount = System.Convert.ToByte(pConsume[index + 1]);
                    sd.NumRequire.Add(pskill);
                }
            }
            if (SkillSetting.SkillDataList[sd.ID] != null)
            {
                LogMgr.Log("Exist the same skill id.");
                InitLogic.SetInitFailed();
                yield break;
            }
            SkillSetting.SkillDataList[sd.ID] = sd;
        }
        yield return(new WaitForEndOfFrame());

        //Rate
        int rateCount = rateNode.ChildNodes.Count;

        BulletSetting.BulletRate = new ushort[rateCount];
        BulletSetting.RateUnlock = new ushort[rateCount];
        BulletSetting.RateReward = new ushort[rateCount];
        for (int i = 0; i < rateCount; ++i)
        {
            XmlNode node = rateNode.ChildNodes[i];
            byte    byid = 0;
            Attribute(node, "id", ref byid);
            Attribute(node, "value", ref BulletSetting.BulletRate[byid]);
            Attribute(node, "unlock", ref BulletSetting.RateUnlock[byid]);
            Attribute(node, "unlockreward", ref BulletSetting.RateReward[byid]);
        }

        //Fish
        int fishCount = fishNode.ChildNodes.Count;

        FishSetting.FishDataList = new FishData[fishCount];
        for (int i = 0; i < fishCount; ++i)
        {
            XmlNode  node = fishNode.ChildNodes[i];
            FishData fd   = new FishData();
            Attribute(node, "id", ref fd.ID);
            Attribute(node, "value", ref fd.Gold);
            fd.Name = node.Attributes["name"].Value;
            fd.Decl = node.Attributes["declare"].Value;
            if (FishSetting.FishDataList[fd.ID] != null)
            {
                LogMgr.Log("Exist the same fish id:" + fd.ID);
                InitLogic.SetInitFailed();
                yield break;
            }
            FishSetting.FishDataList[fd.ID] = fd;

            byte maxcount = 0;
            Attribute(node, "maxcount", ref maxcount);
            nFishs      += maxcount;
            nFishValues += maxcount * fd.Gold;
        }
        FishSetting.SortByGold();
        yield return(new WaitForEndOfFrame());

        //Rank
        int nRank = rankNode.ChildNodes.Count;

        Experience.Exp = new uint[nRank];
        for (int i = 0; i < nRank; i++)
        {
            XmlNode node = rankNode.ChildNodes[i];
            byte    byid = 0;
            Attribute(node, "id", ref byid);
            Attribute(node, "experience", ref Experience.Exp[byid]);
        }


        ///
        //FishDeadTime
        FishDeadTimeData ftd = new FishDeadTimeData();

        Attribute(dstNode, "TianZai_DouDong", ref ftd.TianZai_DouDong_Time);//float.Parse(fishDeadNode.ChildNodes[0].FirstChild.Value);
        Attribute(dstNode, "TianZai_Stay_Min", ref ftd.TianZai_Stay_Time1);
        Attribute(dstNode, "TianZai_Stay_Max", ref ftd.TianZai_Stay_Time2);
        Attribute(dstNode, "TianZai_Dead_Min", ref ftd.TianZai_Dead_Time1);
        Attribute(dstNode, "TianZai_Dead_Max", ref ftd.TianZai_Dead_Time2);
        Attribute(dstNode, "Bullet_BingDong_Dead_Min", ref ftd.Bullet_BingDong_Dead_Time1);
        Attribute(dstNode, "Bullet_BingDong_Dead_Max", ref ftd.Bullet_BingDong_Dead_Time2);
        Attribute(dstNode, "BingDong_Dead_Min", ref ftd.BingDong_Dead_Time1);
        Attribute(dstNode, "BingDong_Dead_Max", ref ftd.BingDong_Dead_Time2);
        Attribute(dstNode, "ShanDian_Dead_Min", ref ftd.ShanDian_Dead_Time1);
        Attribute(dstNode, "ShanDian_Dead_Max", ref ftd.ShanDian_Dead_Time2);
        Attribute(dstNode, "LongJuanFeng_Dead_Min", ref ftd.LongJuanFeng_Dead_Time1);
        Attribute(dstNode, "LongJuanFeng_Dead_Max", ref ftd.LongJuanFeng_Dead_Time2);
        Attribute(dstNode, "JiGuang_Stay_Time", ref ftd.JiGuang_Stay_Time);
        Attribute(dstNode, "JiGuang_Dead_Min", ref ftd.JiGuang_Dead_Time1);
        Attribute(dstNode, "JiGuang_Dead_Max", ref ftd.JiGuang_Dead_Time2);
        Attribute(dstNode, "ShandDian_Speed", ref ftd.ShandDian_Speed);
        Attribute(dstNode, "JiGuang_Speed", ref ftd.JiGuang_Speed);
        Attribute(dstNode, "JiGuang_BingDong_Speed", ref ftd.JiGuang_BingDong_Speed);
        Attribute(dstNode, "TianZai_Speed", ref ftd.TianZai_Speed);
        Attribute(dstNode, "BingDong_Speed", ref ftd.BingDong_Speed);
        FishSetting.FishDeadTime = ftd;
        //cal
        for (int i = 0; i < launcherCount; i++)
        {
            LauncherInfo item = plauncherinfo[i];
            item.nincome = (ushort)((item.nmincatch + item.nmaxcatch) / 2.0f / nFishs * nFishValues + item.nrevise);
            LauncherSetting.LauncherDataList[i].Energy = (ushort)(item.nincome * item.denergyratio);//大招
        }
        yield return(new WaitForEndOfFrame());

        int roomCount = 4;

        ExtraSetting.RoomDataList = new RoomData[roomCount];
        for (int i = 0; i < roomCount; ++i)
        {
            RoomData rd = new RoomData();
            rd.RoomID      = (byte)i;
            rd.RoomRateIdx = (byte)i;
            ExtraSetting.RoomDataList[i] = rd;
        }


        //XmlNode childNode = pConfig.SelectSingleNode("RoomInfo");
        //if (childNode == null)
        //{
        //    LogMgr.Log("RoomInfo not found.");
        //    InitLogic.SetInitFailed();
        //    yield break;
        //}
        //int roomCount = childNode.ChildNodes.Count;
        //ExtraSetting.RoomDataList = new RoomData[roomCount];
        //for (int i = 0; i < roomCount; ++i)
        //{
        //    RoomData rd = new RoomData();
        //    rd.RoomID = byte.Parse(childNode.ChildNodes[i].Attributes["id"].Value);
        //    rd.RoomRateIdx = byte.Parse(childNode.ChildNodes[i].FirstChild.Value);
        //    if (ExtraSetting.RoomDataList[rd.RoomID] != null)
        //    {
        //        LogMgr.Log("Exist the same room id.");
        //        InitLogic.SetInitFailed();
        //        yield break;
        //    }
        //    ExtraSetting.RoomDataList[rd.RoomID] = rd;
        //}
        ResManager.Instance.UnloadObject(obj);
        InitLogic.EndInit();
    }
        private void SwitchLauncher(LauncherInfo info) {
            if (_curLauncher != null) {
                tableLayout.Controls.Remove(_curLauncher);
            }

            if (info == null) {
                _curLauncher = null;
                _debuggerToolTip.SetToolTip(_launchModeCombo, null);
                return;
            }

            var newLauncher = info.OptionsControl;
            info.LauncherOptions.LoadSettings();
            tableLayout.Controls.Add(newLauncher);
            tableLayout.SetCellPosition(newLauncher, new TableLayoutPanelCellPosition(0, 1));
            tableLayout.SetColumnSpan(newLauncher, 2);
            newLauncher.Dock = DockStyle.Fill;
            _curLauncher = newLauncher;
            _debuggerToolTip.SetToolTip(_launchModeCombo, info.Launcher.Description);
        }
        internal void LoadSettings()
        {
            var compModel = JToolsPackage.ComponentModel;
            var launchers = compModel.GetExtensions<IJLauncherProvider>();
            var launchProvider = _propPage.Project.GetProjectProperty(JConstants.LaunchProvider, false);
            if (String.IsNullOrWhiteSpace(launchProvider)) {
                launchProvider = DefaultLauncherProvider.DefaultLauncherDescription;
            }

            foreach (var launcher in launchers) {
                var launchInfo = new LauncherInfo((JProjectNode)_propPage.Project, launcher);
                launchInfo.LauncherOptions.DirtyChanged += LauncherOptionsDirtyChanged;
                _launchers.Add(launchInfo);
                this._launchModeCombo.Items.Add(launcher.Name);

                if (launcher.Name == launchProvider) {
                    _launchModeCombo.SelectedIndexChanged -= LaunchModeComboSelectedIndexChanged;
                    _launchModeCombo.SelectedIndex = _launchModeCombo.Items.Count - 1;
                    _launchModeCombo.SelectedIndexChanged += LaunchModeComboSelectedIndexChanged;
                    _debuggerToolTip.SetToolTip(_launchModeCombo, launcher.Description);

                    SwitchLauncher(launchInfo);
                }
            }
        }