Esempio n. 1
0
 private void OnMissionServerComplete(MissionData i_missionData)
 {
     if (i_missionData.MissionCategory == BackendConstants.MISSION_TYPE_REPEATABLE_QUEST)
     {
         DownloadRepeatableQuestProgress();
     }
 }
        /*
         *      // right now this is just for testing
         * public void GetMission(string i_missionType, Callback<MissionData> i_callback ) {
         *  Dictionary<string, string> cloudParams = new Dictionary<string, string>();
         *  cloudParams.Add( BackendConstants.MISSION_TYPE, i_missionType );
         *
         *  MakeCloudCall( BackendConstants.GET_MISSIONS, cloudParams, ( results ) => {
         *      if ( results.ContainsKey( BackendConstants.DATA ) ) {
         *          List<MissionData> listMissions = JsonConvert.DeserializeObject<List<MissionData>>( results[BackendConstants.DATA] );
         *          i_callback( listMissions[0] );
         *      }
         *  } );
         * }
         */

        private void OnGotMission(MissionData i_data)
        {
            mTestMission = new Mission(i_data);
            GameObject  missionUI = gameObject.InstantiateUI(MissionViewPrefab, MainCanvas);
            MissionView view      = missionUI.GetComponent <MissionView>();

            view.Init(mTestMission);
        }
Esempio n. 3
0
        public Mission(MissionData i_data)
        {
            mModel = new ViewModel();
            mData  = i_data;

            SetUpModel();

            CreateMissionTasks();
        }
Esempio n. 4
0
        private void OnMissionCompleted(MissionData i_missionData)
        {
            if (i_missionData.Index == mData.Index)
            {
                SetCompletedState(true);
                SetAreaAccessibility(false);
            }

            SetAreaUnlockedState(); // "inefficient" to check every area
            SetAreaAccessibility(!Progress.Completed && IsAreaUnlocked());
        }
        public void CompleteMission(MissionData i_mission, Dictionary <int, MissionTaskProposal> i_taskProposals)
        {
            Dictionary <string, string> cloudParams = new Dictionary <string, string>();

            cloudParams.Add(BackendConstants.MISSION_TYPE, i_mission.MissionCategory);
            cloudParams.Add(BackendConstants.MISSION_WORLD, i_mission.MissionWorld);
            cloudParams.Add(BackendConstants.MISSION_INDEX, i_mission.Index.ToString());
            cloudParams.Add(BackendConstants.MISSION_PROPOSALS, JsonConvert.SerializeObject(i_taskProposals));

            QueueCloudCall(BackendConstants.COMPLETE_MISSION, cloudParams, (result) => {
                EasyMessenger.Instance.Send(MISSION_COMPLETED_ON_SERVER_MESSAGE, i_mission);
            });
        }
Esempio n. 6
0
        private void OnMissionClientComplete(MissionData i_missionData)
        {
            ApplyMissionRewards(i_missionData);

            if (i_missionData.MissionCategory == BackendConstants.MISSION_TYPE_MAP)
            {
                IncrementMetric(GameMetricsList.TOTAL_MISSIONS_DONE);
                UpdateMissionProgress(i_missionData.MissionWorld, i_missionData.Index);
                CheckForUnitUnlock();
                SendMissionClientCompleteProcessed(i_missionData);
            }
            else if (i_missionData.MissionCategory == BackendConstants.MISSION_TYPE_REPEATABLE_QUEST)
            {
                SetRepeatableQuestFinished(BackendConstants.WORLD_BASE);
            }
        }
        private void CreateTestMission_Offline()
        {
            MissionData testMissionData = new MissionData();

            testMissionData.DescriptionKey = "TEST_MISSION_DESC";
            testMissionData.Index          = 0;

            MissionTaskData taskA = new MissionTaskData();

            taskA.DescriptionKey   = "Task 1";
            taskA.PowerRequirement = 5000;
            taskA.StatRequirement  = "TEST_STAT_1";

            MissionTaskData taskB = new MissionTaskData();

            taskB.DescriptionKey   = "Task 2";
            taskB.PowerRequirement = 2000;
            taskB.StatRequirement  = "TEST_STAT_2";

            MissionTaskData taskC = new MissionTaskData();

            taskC.DescriptionKey   = "Task 3";
            taskC.PowerRequirement = 2000;
            taskC.StatRequirement  = "TEST_STAT_2";

            //testMissionData.Tasks = new List<MissionTaskData>() { taskA };
            testMissionData.Tasks = new List <MissionTaskData>()
            {
                taskA, taskB, taskC
            };

            mTestMission = new Mission(testMissionData);

            GameObject  missionUI = gameObject.InstantiateUI(MissionViewPrefab, MainCanvas);
            MissionView view      = missionUI.GetComponent <MissionView>();

            view.Init(mTestMission);

            //List<MissionData> listMissions = new List<MissionData>();
            //listMissions.Add( testMissionData );
            //string missionAsJSON = JsonConvert.SerializeObject( listMissions );
            //UnityEngine.Debug.LogError( missionAsJSON );
        }
 public void CompleteMission(MissionData i_mission, Dictionary <int, MissionTaskProposal> i_taskProposals)
 {
     throw new NotImplementedException();
 }
Esempio n. 9
0
 private void ApplyMissionRewards(MissionData i_missionData)
 {
     GainResources(VirtualCurrencies.GOLD, i_missionData.GoldReward);
 }
Esempio n. 10
0
 private void SendMissionClientCompleteProcessed(MissionData i_missionData)
 {
     EasyMessenger.Instance.Send(MissionKeys.MISSION_CLIENT_COMPLETE_PROCESSED, i_missionData);
 }