Ejemplo n.º 1
0
    void CheckAddCheatItem(string msg)
    {
        if (null == MainPlayer.Instance.entity)
        {
            return;
        }

        CheatData data = CheatData.GetData(msg);

        if (null != data)
        {
            if (1 == data.addType)
            {
                if (MainPlayer.Instance.entity.packageCmpt.Add(data.itemID, 1) && "0" != data.successNotice)
                {
                    PeTipMsg.Register(data.successNotice, PeTipMsg.EMsgLevel.HighLightRed);
                }
            }
            else if (2 == data.addType)
            {
                if (0 == VCEditor.MakeCreation("Isos/Mission/" + data.isoName) && "0" != data.successNotice)
                {
                    PeTipMsg.Register(data.successNotice, PeTipMsg.EMsgLevel.HighLightRed);
                }
            }
        }
    }
Ejemplo n.º 2
0
    protected override void Start()
    {
        base.Start();

        if(_inControlInputModule)
            _inControlInputModule.enabled = false;
        if(_standaloneInputModule)
            _standaloneInputModule.enabled = false;

        // Use reflection to gather any cheats define in SROptions.
        var type = SROptions.Current.GetType();
        var methods = type.GetMethods();
        foreach(var method in methods)
        {
            var cheatShortcut = (method.GetCustomAttributes(typeof(CheatShortcutAttribute), false) as CheatShortcutAttribute[]).FirstOrDefault();
            if(cheatShortcut != null)
            {
                var category = method.GetCustomAttributes(typeof(CategoryAttribute), false) as CategoryAttribute[];
                var cheatData = new CheatData(category.Length > 0 ? category[0].Category : string.Empty, method.Name, CreateAction(method), cheatShortcut.KeyCodes);
                Cheats.Add(cheatData);
            }
        }

        SRDebug.Instance.PanelVisibilityChanged += OnPanelVisibilityChanged;
    }
Ejemplo n.º 3
0
        private async void  addButton_Click(object sender, RoutedEventArgs e)
        {
            if (!this.CheckCodeFormat(this.cheatCodeBox.Text,
                                      (s) =>
            {
                MessageBox.Show(s, AppResources.ErrorCaption, MessageBoxButton.OK);
            }))
            {
                return;
            }
            string[] codes = this.GetCodes(this.cheatCodeBox.Text);
            for (int i = 0; i < codes.Length; i++)
            {
                CheatData cheat = new CheatData()
                {
                    CheatCode   = codes[i],
                    Description = this.cheatDescBox.Text,
                    Enabled     = true
                };
                this.cheatCodes.Add(cheat);
            }
            RefreshCheatList();
            this.cheatCodeBox.Text = "";
            this.cheatDescBox.Text = "";

            FileHandler.SaveCheatCodes(this.romEntry, this.cheatCodes);
        }
Ejemplo n.º 4
0
        private void cheatEnabledBox_Unchecked(object sender, RoutedEventArgs e)
        {
            ListBoxItem contextMenuListItem = this.cheatList.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem;
            CheatData   cheatData           = contextMenuListItem.DataContext as CheatData;

            cheatData.Enabled = false;
        }
Ejemplo n.º 5
0
        internal static async Task <List <CheatData> > LoadCheatCodes(ROMDBEntry re)
        {
            List <CheatData> cheats      = new List <CheatData>();
            String           romFileName = re.FileName;
            int index = romFileName.LastIndexOf('.');
            int diff  = romFileName.Length - index;

            string cheatFileName = romFileName.Substring(0, romFileName.Length - diff);

            cheatFileName += ".cht";

            StorageFolder localFolder = ApplicationData.Current.LocalFolder;
            StorageFolder romFolder   = await localFolder.GetFolderAsync(ROM_DIRECTORY);

            StorageFolder saveFolder = await romFolder.GetFolderAsync(SAVE_DIRECTORY);

            StorageFile file = null;

            try
            {
                file = await saveFolder.GetFileAsync(cheatFileName);
            }
            catch (System.IO.FileNotFoundException)
            {
                return(cheats);
            }
            string codes = null;

            using (var stream = await file.OpenReadAsync())
            {
                using (var readStream = stream.GetInputStreamAt(0L))
                {
                    using (DataReader reader = new DataReader(readStream))
                    {
                        await reader.LoadAsync((uint)stream.Size);

                        codes = reader.ReadString((uint)stream.Size);
                    }
                }
            }
            if (!String.IsNullOrWhiteSpace(codes))
            {
                string[] lines = codes.Split('\n');
                for (int i = 0; i < lines.Length; i += 3)
                {
                    if (lines.Length - i < 3)
                    {
                        continue;
                    }
                    CheatData data = new CheatData();
                    data.Description = lines[i];
                    data.CheatCode   = lines[i + 1];
                    data.Enabled     = lines[i + 2].Equals("1");

                    cheats.Add(data);
                }
            }

            return(cheats);
        }
Ejemplo n.º 6
0
        //private async void cheatEnabledBox_Checked(object sender, RoutedEventArgs e)
        //{

        //        ListBoxItem contextMenuListItem = this.cheatList.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem;
        //        CheatData cheatData = contextMenuListItem.DataContext as CheatData;
        //        cheatData.Enabled = true;


        //}

        //private async void cheatEnabledBox_Unchecked(object sender, RoutedEventArgs e)
        //{
        //        ListBoxItem contextMenuListItem = this.cheatList.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem;
        //        CheatData cheatData = contextMenuListItem.DataContext as CheatData;
        //        cheatData.Enabled = false;

        //}

        private void cheatEnabledBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            bool isChecked = (sender as CheckBox).IsChecked.Value;

            ListBoxItem contextMenuListItem = this.cheatList.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem;
            CheatData   cheatData           = contextMenuListItem.DataContext as CheatData;

            cheatData.Enabled = isChecked;
        }
Ejemplo n.º 7
0
        private async void editButton_Click(object sender, EventArgs e)
        {
            if (this.cheatList.SelectedItem == null)
            {
                MessageBox.Show(AppResources.CheatNoSelection, AppResources.ErrorCaption, MessageBoxButton.OK);
                return;
            }

            CheatData cheatdata = this.cheatList.SelectedItem as CheatData;


            //disable current page
            this.IsHitTestVisible    = false;
            ApplicationBar.IsVisible = false;

            //create new popup instance


            popupWindow = new Popup();
            EditCheatControl.TextToEdit = cheatdata.CheatCode;
            EditCheatControl.PromptText = AppResources.EnterNewCheatText;
            popupWindow.Child           = new EditCheatControl();


            popupWindow.VerticalOffset   = 0;
            popupWindow.HorizontalOffset = 0;
            popupWindow.IsOpen           = true;

            popupWindow.Closed += async(s1, e1) =>
            {
                this.IsHitTestVisible    = true;
                ApplicationBar.IsVisible = true;

                if (EditCheatControl.IsOKClicked &&
                    this.CheckCodeFormat(EditCheatControl.TextToEdit,
                                         (s) =>
                {
                    MessageBox.Show(s, AppResources.ErrorCaption, MessageBoxButton.OK);
                }))
                {
                    cheatdata.CheatCode = EditCheatControl.TextToEdit;
                    RefreshCheatList();
                    await FileHandler.SaveCheatCodes(this.romEntry, this.cheatCodes);
                }
            };
        }
Ejemplo n.º 8
0
    public static void LoadData()
    {
        List <CheatData> dataList = new List <CheatData>();

        SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("CheatData");

        while (reader.Read())
        {
            CheatData data = new CheatData();
            data.cheatCode     = PETools.Db.GetString(reader, "Code").ToLower();
            data.successNotice = PELocalization.GetString(PETools.Db.GetInt(reader, "SuccessedNotice"));
            data.addType       = PETools.Db.GetInt(reader, "AddType");
            data.itemID        = PETools.Db.GetInt(reader, "ItemID");
            data.isoName       = PETools.Db.GetString(reader, "ISOName");
            dataList.Add(data);
        }
        g_Datas = dataList.ToArray();
    }
Ejemplo n.º 9
0
        private void ConvertCode()
        {
            //Automatically update the other fields to match the active code (when possible)
            UpdateObject();

            CheatInfo cheat = (CheatInfo)this.Entity;

            if (cheat.CheatType == CheatType.GameGenie)
            {
                CheatData convertedData = ConvertGameGenieCode(cheat.GameGenieCode.ToUpper());
                txtProActionRocky.Text  = ToProActionReplayCode(convertedData.Address, convertedData.Value, convertedData.CompareValue);
                txtAddress.Text         = convertedData.Address.ToString("X4");
                txtValue.Text           = convertedData.Value.ToString("X2");
                txtCompare.Text         = convertedData.CompareValue >= 0 ? convertedData.CompareValue.ToString("X2") : "";
                chkCompareValue.Checked = convertedData.CompareValue >= 0;
            }
            else if (cheat.CheatType == CheatType.ProActionRocky)
            {
                CheatData convertedData = ConvertProActionReplayCode(cheat.ProActionRockyCode);
                txtGameGenie.Text          = ToGameGenieCode(convertedData.Address, convertedData.Value, convertedData.CompareValue);
                txtAddress.Text            = convertedData.Address.ToString("X4");
                txtValue.Text              = convertedData.Value.ToString("X2");
                txtCompare.Text            = convertedData.CompareValue.ToString("X2");
                radRelativeAddress.Checked = true;
                chkCompareValue.Checked    = true;
            }
            else
            {
                if (cheat.IsRelativeAddress && cheat.Address >= 0x8000)
                {
                    txtGameGenie.Text      = ToGameGenieCode((int)cheat.Address, cheat.Value, cheat.UseCompareValue ? cheat.CompareValue : -1);
                    txtProActionRocky.Text = ToProActionReplayCode((int)cheat.Address, cheat.Value, cheat.UseCompareValue ? cheat.CompareValue : -1);
                }
                else
                {
                    txtProActionRocky.Text = "";
                    txtGameGenie.Text      = "";
                }
            }
        }
Ejemplo n.º 10
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            if (!this.CheckCodeFormat(this.cheatCodeBox.Text,
                (s) =>
                {
                    MessageBox.Show(s, AppResources.ErrorCaption, MessageBoxButton.OK);
                }))
            {
                return;
            }
            string[] codes = this.GetCodes(this.cheatCodeBox.Text);
            for (int i = 0; i < codes.Length; i++)
            {
                CheatData cheat = new CheatData()
                {
                    CheatCode = codes[i],
                    Description = this.cheatDescBox.Text,
                    Enabled = true
                };
                this.cheatCodes.Add(cheat);
            }
            RefreshCheatList();
            this.cheatCodeBox.Text = "";
            this.cheatDescBox.Text = "";

            FileHandler.SaveCheatCodes(this.romEntry, this.cheatCodes);
        }
Ejemplo n.º 11
0
    public static void LoadAllData()
    {
        if (s_localDatabase != null)
        {
            return;
        }

#if UNITY_EDITOR
        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        sw.Start();
#endif
        s_localDatabase = LoadDb();
        SkillSystem.SkData.LoadData();
        Pathea.Effect.EffectData.LoadData();
        Pathea.Projectile.ProjectileData.LoadData();
        Pathea.RequestRelation.LoadData();
        Pathea.CampData.LoadData();
        Pathea.ThreatData.LoadData();
        Pathea.DamageData.LoadData();
        HumanSoundData.LoadData();
        ItemDropData.LoadData();

        PELocalization.LoadData();

        NaturalResAsset.NaturalRes.LoadData();
        //SkillAsset.EffCastData.LoadData();
        //SkillAsset.EffSkill.LoadData();
        //SkillAsset.MergeSkill.LoadData();
        //AnimData.LoadData();
        //AnimSoundData.LoadData();

        AiAsset.AiData.LoadData();

        SoundAsset.SESoundBuff.LoadData();
        SoundAsset.SESoundStory.LoadData();
        //CharacterData.LoadCharacterData();
        StoryDoodadMap.LoadData();
        StoreRepository.LoadData();
        NpcMissionDataRepository.LoadData();
        //PlayerAttribute.LoadData();
        MissionRepository.LoadData();
        TalkRespository.LoadData();
        //NpcRandomRepository.LoadData();
        ShopRespository.LoadData();
        WareHouseManager.LoadData();
        //HeroTalkRepository.LoadData();
        MutiPlayRandRespository.LoadData();
        PromptRepository.LoadData();

        //MapIconData.LoadDate();
        //MapMaskData.LoadDate();
        CampPatrolData.LoadDate();
        Camp.LoadData();
        RepProcessor.LoadData();

        CloudManager.LoadData();
        //BattleUnitData.LoadData();
        TutorialData.LoadData();
        //RepairMachineManager.LoadData();
        MapMaskData.LoadDate();
        MessageData.LoadData();         //lz-2016.07.13 Add it
        MonsterHandbookData.LoadData(); //lz-2016.07.20 Add it
        StoryRepository.LoadData();
        RMRepository.LoadRandMission();
        MisInitRepository.LoadData();
        CameraRepository.LoadCameraPlot();
        AdRMRepository.LoadData();
        VCConfig.InitConfig();
        Cutscene.LoadData();

//		BuildBrushData.LoadBrush();
        BSPattern.LoadBrush();
        BSVoxelMatMap.Load();
        BSBlockMatMap.Load();
        BlockBuilding.LoadBuilding();
        LifeFormRule.LoadData();
        PlantInfo.LoadData();
        MetalScanData.LoadData();
        BattleConstData.LoadData();
        CustomCharactor.CustomMetaData.LoadData();
        SkillTreeInfo.LoadData();
        VArtifactUtil.LoadData();
        Pathea.ActionRelationData.LoadActionRelation();

        //colony
        CSInfoMgr.LoadData();
        ProcessingObjInfo.LoadData();
        CSTradeInfoData.LoadData();
        CampTradeIdData.LoadData();
        AbnormalTypeTreatData.LoadData();
        CSMedicineSupport.LoadData();
        //RandomItemMgr
        RandomItemDataMgr.LoadData();
        FecesData.LoadData();
        //randomdungeon
        RandomDungeonDataBase.LoadData();
        AbnormalData.LoadData();
        PEAbnormalNoticeData.LoadData();

        RelationInfo.LoadData();
        EquipSetData.LoadData();
        SuitSetData.LoadData();

        CheatData.LoadData();

        Pathea.NpcProtoDb.Load();
        Pathea.MonsterProtoDb.Load();
        Pathea.MonsterRandomDb.Load();
        Pathea.MonsterGroupProtoDb.Load();
        Pathea.RandomNpcDb.Load();
        Pathea.PlayerProtoDb.Load();
        Pathea.TowerProtoDb.Load();
        Pathea.DoodadProtoDb.Load();
        Pathea.AttPlusNPCData.Load();
        Pathea.AttPlusBuffDb.Load();
        Pathea.NpcTypeDb.Load();
        Pathea.NpcRandomTalkDb.Load();
        Pathea.NpcThinkDb.LoadData();
        Pathea.NpcEatDb.LoadData();
        Pathea.NpcRobotDb.Load();
        Pathea.NPCScheduleData.Load();
        Pathea.NpcVoiceDb.LoadData();
        InGameAidData.LoadData(); //lz-2016.08.21 add it
        MountsSkillDb.LoadData();

#if UNITY_EDITOR
        sw.Stop();
        Debug.Log("Database Loaded : " + sw.ElapsedMilliseconds);
        sw.Reset();
#else
        Debug.Log("Database Loaded");
#endif
    }