コード例 #1
0
ファイル: SimpleMissionEmmitter.cs プロジェクト: Shahabz/crm
    void Start()
    {
        //PlayerPrefs.DeleteAll();//TODO: delete this
        //Ищем только миссии, которые еще не выполнялись и текущие тоже ищем
        Dictionary <string, string> currentMissionsKeyData = CurrentMissionsSerializer.GetCurrentMissionsKeyData(misionCurrentTag);

        for (int i = 0; i < missions.Length; i++)
        {
            Mission missionPrefab = missions [i];
            string  id            = missionPrefab.name;
            missionPrefab.SetId(id);
            if (!IsMissionFinished(id))
            {
                prefabKeyDictionary [missionPrefab] = id;
                if (currentMissionsKeyData.ContainsKey(id))
                {
                    Mission mission = InstantiateMission(missionPrefab);
                    mission.Unserialize(currentMissionsKeyData [id].ToString());
                    currentMissions.Add(mission);
                }
                else
                {
                    availableMissionsPrefabs.Add(missionPrefab);
                }
            }
            else
            {
                finishedMissionsNumber++;
            }
        }
        EmmitMissions(true);
    }
コード例 #2
0
ファイル: BaseMissionEmmitter.cs プロジェクト: Shahabz/crm
 //IMissionListener
 public void MissionProgressChanged(Mission mission)
 {
     if (!mission.oneLife)
     {
         CurrentMissionsSerializer.SaveMissionData(mission);
     }
 }
コード例 #3
0
ファイル: BaseMissionEmmitter.cs プロジェクト: Shahabz/crm
 public void MissionFinished(Mission mission)
 {
     finishedMissionsNumber++;
     GlobalOptions.GetPlayerScript().Yahoo();
     SetMissionFinished(mission.GetId());
     currentMissions.Remove(mission);
     if (currentMissions.Count == 0)
     {
         NotifyNoMissions();
     }
     thisLifeFinishedMissions.Add(mission);
     CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     CurrentMissionsSerializer.RemoveMissionData(mission);
     timeOutTime = Time.time + GetTimeOut();
 }
コード例 #4
0
ファイル: SimpleMissionEmmitter.cs プロジェクト: Shahabz/crm
 public virtual void EmmitMissions(bool force = false)
 {
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)          //инициализируем текущую
     {
         Mission currentMission = GetOneMissionObject();
         if (currentMission != null)
         {
             NotifyHasMissions();
             currentMissions.Add(currentMission);
         }
         CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     }
 }
コード例 #5
0
ファイル: FermaMissionEmmitter.cs プロジェクト: Shahabz/crm
 private void TryToGetNextFromEmmitted(bool force = false)
 {
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)      //инициализируем текущую
     {
         if (emmittedMissionsPrefabs.Count > 0)
         {
             Mission missionPrefab  = (Mission)emmittedMissionsPrefabs [0];
             Mission currentMission = InstantiateMission(missionPrefab);
             emmittedMissionsPrefabs.RemoveAt(0);
             currentMissions.Add(currentMission);
             CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);                         //save
             CurrentMissionsSerializer.SaveCurrentMissions(emmittedMissionsPrefabs, misionEmmittedTag);
         }
     }
 }
コード例 #6
0
ファイル: FermaMissionEmmitter.cs プロジェクト: Shahabz/crm
    void Start()
    {
        this.name = this.name.Replace("(Clone)", "");
        //Ищем только миссии, которые еще не выполнялись и текущие тоже ищем
        Dictionary <string, string> currentMissionsKeyData = CurrentMissionsSerializer.GetCurrentMissionsKeyData(misionCurrentTag);
        Dictionary <string, string> emittedMissionsKeyData = CurrentMissionsSerializer.GetCurrentMissionsKeyData(misionEmmittedTag);

        for (int i = 0; i < missions.Length; i++)
        {
            Mission missionPrefab = missions [i];
            string  id            = missionPrefab.name;
            missionPrefab.SetId(id);
            if (!IsMissionFinished(id))
            {
                prefabKeyDictionary [missionPrefab] = id;
                if (currentMissionsKeyData.ContainsKey(id))
                {
                    Mission mission = InstantiateMission(missionPrefab);
                    mission.Unserialize(currentMissionsKeyData [id].ToString());
                    currentMissions.Add(mission);
                }
                else if (emittedMissionsKeyData.ContainsKey(id))
                {
                    emmittedMissionsPrefabs.Add(missionPrefab);
                }
                else
                {
                    availableMissionsPrefabs.Add(missionPrefab);
                }
            }
            else
            {
                finishedMissionsNumber++;
            }
        }
        //инициализируем cлоты (куплены они или нет)
        for (int i = 0; i < slots.Length; i++)
        {
            Slot slot = slots [i];
            slot.Init();
        }
        EmmitMissions(false);
    }
コード例 #7
0
ファイル: FermaMissionEmmitter.cs プロジェクト: Shahabz/crm
    public void EmmitMissions(bool force = false)
    {
        TryToGetNextFromEmmitted();

        if (force || canEmmitMissions())
        {
            Mission currentMission = null;
            TryToGetNextFromEmmitted(true);
            if (currentMissions.Count == 0)          //инициализируем текущую
            {
                currentMission = GetOneMissionObject();
                if (currentMission != null)
                {
                    NotifyHasMissions();
                    currentMissions.Add(currentMission);
                }
                CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
            }
            //emmitted
            int numberOfBoughtSlots = NumberOfBoughtSlots();
            if (emmittedMissionsPrefabs.Count < numberOfBoughtSlots - 1)
            {
                for (int i = emmittedMissionsPrefabs.Count; i < numberOfBoughtSlots - 1; i++)
                {
                    if (availableMissionsPrefabs.Count > 0)
                    {
                        Mission missionPrefab = (Mission)availableMissionsPrefabs [0];
                        availableMissionsPrefabs.Remove(missionPrefab);
                        emmittedMissionsPrefabs.Add(missionPrefab);
                    }
                }
                CurrentMissionsSerializer.SaveCurrentMissions(emmittedMissionsPrefabs, misionEmmittedTag);
            }
            lastMissionEmmitTime = GlobalOptions.GetLongFromDateTime(System.DateTime.UtcNow);
            MissionsUpdated();
        }
    }
コード例 #8
0
 public override void EmmitMissions(bool force = false)
 {
     if (!PersonInfo.tutorial)
     {
         return;
     }
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)          //инициализируем текущую
     {
         Mission currentMission = GetOneMissionObject();
         if (currentMission != null)
         {
             currentMissions.Add(currentMission);
         }
         else
         {
             PersonInfo.FinishTutorial();
         }
         CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     }
 }
コード例 #9
0
ファイル: BaseMissionEmmitter.cs プロジェクト: Shahabz/crm
 public void MissionActivated(Mission mission)
 {
     CurrentMissionsSerializer.SaveMissionData(mission);
 }