Ejemplo n.º 1
0
        public void RecordTheDataInGame()
        {
            // Save GameLevel,PlayerLevel,PlayerExp in file.
            List <PatientConfigList> patientConfigList = new List <PatientConfigList>();
            PatientConfigList        patientConfig     = new PatientConfigList();

            patientConfig.Address       = PatientinfoMgr.GetInstance().ShowValue("Address") ?? string.Empty;
            patientConfig.Age           = PatientinfoMgr.GetInstance().ShowValue("Age") ?? string.Empty;
            patientConfig.AvatarID      = PatientinfoMgr.GetInstance().ShowValue("AvatarID") ?? string.Empty;
            patientConfig.CaseID        = PatientinfoMgr.GetInstance().ShowValue("CaseID") ?? string.Empty;
            patientConfig.CreateDate    = PatientinfoMgr.GetInstance().ShowValue("CreateDate") ?? string.Empty;
            patientConfig.Department    = PatientinfoMgr.GetInstance().ShowValue("Department") ?? string.Empty;
            patientConfig.Diagnosis     = PatientinfoMgr.GetInstance().ShowValue("Diagnosis") ?? string.Empty;
            patientConfig.Exp           = _playerExp.ToString() ?? string.Empty;
            patientConfig.Height        = PatientinfoMgr.GetInstance().ShowValue("Height") ?? string.Empty;
            patientConfig.Level         = _playerLevel.ToString() ?? string.Empty;
            patientConfig.Name          = PatientinfoMgr.GetInstance().ShowValue("Name") ?? string.Empty;
            patientConfig.PhoneNumber   = PatientinfoMgr.GetInstance().ShowValue("PhoneNumber") ?? string.Empty;
            patientConfig.PlayerID      = PatientinfoMgr.GetInstance().ShowValue("PlayerID") ?? string.Empty;
            patientConfig.Relative      = PatientinfoMgr.GetInstance().ShowValue("Relative") ?? string.Empty;
            patientConfig.RelativePhone = PatientinfoMgr.GetInstance().ShowValue("RelativePhone") ?? string.Empty;
            patientConfig.Remark        = PatientinfoMgr.GetInstance().ShowValue("Remark") ?? string.Empty;
            patientConfig.Sex           = PatientinfoMgr.GetInstance().ShowValue("Sex") ?? string.Empty;
            patientConfig.UpdateDate    = PatientinfoMgr.GetInstance().ShowValue("UpdateDate") ?? string.Empty;
            patientConfig.Weight        = PatientinfoMgr.GetInstance().ShowValue("Weight") ?? string.Empty;
            patientConfigList.Add(patientConfig);
            PatientinfoMgr.GetInstance().ModifyJson(patientConfigList);

            UnityEngine.Debug.Log("<color=green>Record successfully!</color>");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the value of GameSetting
        /// </summary>
        void InitializeGameSettingData()
        {
            HOGGameSettingGenerator.Instance.CreateGameSetting();

            int _trainType = HOGGameSettingGenerator.Instance.GameSetting.TrainType;
            //int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.TrainType), out _trainType);
            int _gameCategory = HOGGameSettingGenerator.Instance.GameSetting.GameCategory;

            //int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.GameType), out _gameCategory);
            //int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.TrainTime), out _trainTime);

            #region GetStressValue
            int _stressValue    = 0;
            int _stressLevel    = 0;
            int _obstacleLength = 0;
            switch (_trainType)
            {
            case 2:
                int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.MaxAssist), out _stressValue);
                if (_stressValue == 100)
                {
                    _stressLevel = 1;
                }
                else if (_stressValue == 200)
                {
                    _stressLevel = 2;
                }
                else if (_stressValue == 300)
                {
                    _stressLevel = 3;
                }
                else if (_stressValue == 400)
                {
                    _stressLevel = 4;
                }
                else if (_stressValue == 500)
                {
                    _stressLevel = 5;
                }
                _trainTypeName = "Assistance";
                break;

            case 3:
                if (_gameCategory == 2)
                {
                    int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.ObstacleLength), out _obstacleLength);
                }
                int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.ActiveAssist), out _stressValue);
                if (_stressValue == 20)
                {
                    _stressLevel = 1;
                }
                else if (_stressValue == 35)
                {
                    _stressLevel = 2;
                }
                else if (_stressValue == 40)
                {
                    _stressLevel = 3;
                }
                else if (_stressValue == 55)
                {
                    _stressLevel = 4;
                }
                else if (_stressValue == 70)
                {
                    _stressLevel = 5;
                }
                _trainTypeName = "Active";
                break;

            case 4:
                if (_gameCategory == 3)
                {
                    int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.Mass), out _stressValue);
                    if (_stressValue == 60000)
                    {
                        _stressLevel = 1;
                    }
                    else if (_stressValue == 46000)
                    {
                        _stressLevel = 2;
                    }
                    else if (_stressValue == 34000)
                    {
                        _stressLevel = 3;
                    }
                    else if (_stressValue == 22000)
                    {
                        _stressLevel = 4;
                    }
                    else if (_stressValue == 10000)
                    {
                        _stressLevel = 5;
                    }
                    _trainTypeName = "Mass";
                }
                if (_gameCategory == 1)
                {
                    int.TryParse(GameSettingMgr.GetInstance().ShowValue(HiddenObjectKey.ResistiveAssist), out _stressValue);
                    if (_stressValue == 50)
                    {
                        _stressLevel = 1;
                    }
                    else if (_stressValue == 100)
                    {
                        _stressLevel = 2;
                    }
                    else if (_stressValue == 150)
                    {
                        _stressLevel = 3;
                    }
                    else if (_stressValue == 200)
                    {
                        _stressLevel = 4;
                    }
                    else if (_stressValue == 250)
                    {
                        _stressLevel = 5;
                    }
                    _trainTypeName = "Resistance";
                }
                break;

            default:
                break;
            }
            #endregion

            #region GetScoreDependOnStress
            string levelName = "Level" + _stressLevel;
            _minTargetScore = GlobalApplication.GetDataFromPropExpJson(_trainTypeName, levelName, "Min");
            _maxTargetScore = GlobalApplication.GetDataFromPropExpJson(_trainTypeName, levelName, "Max");
            #endregion

            #region SetRecorder
            _currentGameRecorder = new InGameRecord(_trainType);
            _currentGameRecorder.GameCategory   = _gameCategory;
            _currentGameRecorder.StressValue    = _stressValue;
            _currentGameRecorder.StressLevel    = _stressLevel;
            _currentGameRecorder.ObstacleLength = _obstacleLength;
            // Get level and exp.
            int playerLevel = 0;
            int.TryParse(PatientinfoMgr.GetInstance().ShowValue(HiddenObjectKey.Level), out playerLevel);
            _currentGameRecorder.PlayerLevel = playerLevel;
            int playerExp = 0;
            int.TryParse(PatientinfoMgr.GetInstance().ShowValue(HiddenObjectKey.Exp), out playerExp);
            _currentGameRecorder.PlayerExp = playerExp;
            _currentGameRecorder.GameLevel = 1;
            _currentGameRecorder.Score     = 0;
            _currentGameRecorder.LostTime  = 0;
            #endregion

            GetNextLevelExp(playerLevel);

            // Get Victory Message
            _victoryMessage = LanguageMgr.GetInstance().ShowText(HiddenObjectKey.VictoryMessage).Split('#');

            // Get TimeUp Message
            _timeUpMessage = LanguageMgr.GetInstance().ShowText(HiddenObjectKey.TimeUpMessage);

            // Get Target String
            _targetString = LanguageMgr.GetInstance().ShowText(HiddenObjectKey.TargetString);

            // Get Reward String
            _rewardString = LanguageMgr.GetInstance().ShowText(HiddenObjectKey.RandomReward);

            // Get TopBarTipMessage
            _topBarTipMessage = LanguageMgr.GetInstance().ShowText(HiddenObjectKey.TopBarTipMessage);
        }