예제 #1
0
 public static bool PaymentCheck(ref int target, int payment)
 {
     if (PaymentAbleCheck(ref target, payment))
     {
         if (target == User.coin || target.Equals(User.coin))
         {
             MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalUseCoin, payment);
         }
         else if (target == User.blackCrystal || target.Equals(User.blackCrystal))
         {
             MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalUseCrystal, payment);
         }
         else if (target == User.portalEnergy || target.Equals(User.portalEnergy))
         {
             MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalUseEnergy, payment);
         }
         target -= payment;
         GoogleSignManager.SaveData();
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
    public void SetTutorialState()
    {
        MissionSystem.OnCompleteMission += OnComplete;


        if (MissionSystem.HasCompletedGlobal("find_enemy"))
        {
            Unit.GetAllUnitsOfOwner(0, true)[0].Identify(null);
        }

        if (MissionSystem.HasCompletedGlobal("move_to"))
        {
            Unit.GetAllUnitsOfOwner(1, true)[0].Identify(Unit.GetAllUnitsOfOwner(0, true)[0]);
            Tile close_to_enemy = TileManager.Instance.GetEdgeTiles(M_Math.GetListFromObject(Unit.GetAllUnitsOfOwner(1, true)[0].currentTile), 1, TileManager.Instance).First();
            Unit.GetAllUnitsOfOwner(0, true)[0].SetTile(close_to_enemy, true);
        }

        if (MissionSystem.HasCompletedGlobal("loot"))
        {
            SpawnNext();
            SpawnNext();

            List <Tile> lastRow = TileManager.Instance.GetRow(TileManager.Instance.GridHeight - 1);

            Tile r = lastRow.FirstOrDefault(t => t.isAccessible);

            Unit.GetAllUnitsOfOwner(0, true)[0].SetTile(r, true);
            ;
        }
    }
예제 #3
0
    public IEnumerator StageClearing()
    {
        isStartGame = false;
        isEndGame   = true;
        HeroSystem.SaveHeros(Common.FindAlly());
        MapSystem.MapClear(stageInfo.mapNumber, stageInfo.stageClearPoint);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.StageClear);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalStageCount);
        MissionSystem.PointSave();
        SaveSystem.AddUserCoin(stageInfo.stageCoin);
        stageInfo.stageExp = Common.GetUserExp(stageInfo.stageNumber);
        SaveSystem.ExpUp(stageInfo.stageExp);
        var getItems = GetStageItems();

        for (var i = 0; i < getItems.Count; i++)
        {
            ItemSystem.SetObtainItem(getItems[i].id);
        }
        GoogleSignManager.SaveData();
        UI_Manager.instance.OpenEndGamePanel(true);
        if (UnityEngine.Random.Range(0, 10) < 2)
        {
            GoogleAdMobManager.instance.OnBtnViewAdClicked();
        }
        yield return(null);
    }
예제 #4
0
 public override void Init(List <ObjectiveConfig> _objectives)
 {
     if (_instance == null)
     {
         _instance = this;
         base.Init(_objectives);
         OnInit.AttemptCall();
     }
 }
예제 #5
0
 private void Start()
 {
     HeroSystem.LoadHero();
     SkillSystem.LoadSkill();
     AbilitySystem.LoadAbility();
     ItemSystem.LoadItem();
     MapSystem.LoadMap();
     MissionSystem.LoadMission();
     LocalizationManager.LoadLanguage(User.language);
 }
예제 #6
0
    void StartMission()
    {
        UI_Popup_Global.Instance.OnCloseDone -= StartMission;
        MissionSystem.Instance.Init();
        GameObject.FindObjectOfType <UI_TurnList>().gameObject.SetUIAlpha(MissionSystem.HasCompletedGlobal("kill_enemy_1") ? 1 : 0);
        MissionSystem.OnCompleteMission += OnObjectiveComplete;
        // TurnSystem.Instance.Init();

        GameObject.FindObjectOfType <WorldExtender_Tutorial>().SetTutorialState();
    }
예제 #7
0
파일: Boss.cs 프로젝트: HOBOOK/Flat-Heroes
 void StateUpdate()
 {
     hp = bossPrefabData.status.hp;
     if (bossPrefabData.isDead)
     {
         isEnd = true;
         MissionSystem.AddClearPoint(MissionSystem.ClearType.BossKill);
         StartCoroutine("BossDead");
     }
 }
예제 #8
0
    public static void SetArchivementClearPoint()
    {
        int[] setCheckTypes = { 7, 8, 9, 14, 15 };
        int   point         = 0;

        for (var j = 0; j < setCheckTypes.Length; j++)
        {
            List <Mission> currentMissions = userMissions.FindAll(x => !x.enable && !x.clear && x.clearType == setCheckTypes[j]);
            for (var i = 0; i < currentMissions.Count; i++)
            {
                if (currentMissions[i].missionType == 2)
                {
                    switch (currentMissions[i].clearType)
                    {
                    case 7:
                        point = User.level;
                        break;

                    case 8:
                        point = 0;
                        foreach (var hero in HeroSystem.GetUserHeros())
                        {
                            point += hero.level;
                        }
                        break;

                    case 9:
                        point = User.flatEnergyMaxLevel + User.flatEnergyChargingLevel + User.addMoneyLevel + User.addExpLevel + User.addAttackLevel + User.addDefenceLevel;
                        break;

                    case 14:
                        point = 0;
                        foreach (var skill in SkillSystem.GetPlayerSkillList())
                        {
                            point += SkillSystem.GetUserSkillLevel(skill.id);
                        }
                        break;

                    case 15:
                        point = 0;
                        foreach (var skill in SkillSystem.GetUserHerosSkills())
                        {
                            point += SkillSystem.GetUserSkillLevel(skill.id);
                        }
                        break;
                    }
                    currentMissions[i].point = point;
                    Debugging.Log(MissionSystem.GetMissionName(currentMissions[i].id) + " 의 포인트 > " + point);
                }
            }
        }
        Debugging.Log("업적 세팅타입 설정완료");
    }
예제 #9
0
 public static void OpenUI()
 {
     if (_Instance == null)
     {
         Object prefab = PrefabLoader.loadFromPack("LS/MissionSysRoot");
         if (prefab != null)
         {
             GameObject obj = Instantiate(prefab) as GameObject;
             RED.AddChild(obj, DBUIController.mDBUIInstance._TopRoot);
             _Instance = obj.GetComponent <MissionSystem> ();
         }
     }
 }
예제 #10
0
 void RefreshUI()
 {
     if (slotMissionPrefab != null && ScrollContentViewDailyMission != null & ScrollContentViewWeekMission != null && ScrollContentViewArchivement != null)
     {
         MissionSystem.CheckClearMissions(false);
         ClearView(ScrollContentViewDailyMission.transform);
         ClearView(ScrollContentViewWeekMission.transform);
         ClearView(ScrollContentViewArchivement.transform);
         LoadMissions(MissionSystem.GetDayMissions(), ScrollContentViewDailyMission.transform);
         LoadMissions(MissionSystem.GetWeekMissions(), ScrollContentViewWeekMission.transform);
         LoadMissions(MissionSystem.GetArchivement(), ScrollContentViewArchivement.transform);
     }
 }
예제 #11
0
    static MissionSystem getInstance()
    {
        MissionSystem found = GameObject.FindObjectOfType <MissionSystem>();

        if (found == null)
        {
            // Debug.LogWarning("NO MISSION SYSTEM INSTANCE FOUND");
        }
        else if (_instance == null)
        {
            found.Init();
        }
        return(_instance);
    }
예제 #12
0
    public static void SetObtainHero(int id)
    {
        HeroData obtainHero = heros.Find(h => h.id == id || h.id.Equals(id));

        if (obtainHero != null)
        {
            HeroDatabase.AddUser(id);
            userHeros.Add(obtainHero);
            SkillSystem.SetObtainSkill(obtainHero.skill);
            MissionSystem.AddClearPoint(MissionSystem.ClearType.CollectHero);
            Debugging.Log(id + " 영웅 획득 성공!");
        }
        else
        {
            Debugging.LogError("획득할 영웅을 찾지못함 >> " + id);
        }
    }
예제 #13
0
    public static void SetObtainItem(int id, int count = 1)
    {
        Item obtainItem = userItems.Find(item => item.id == id || item.id.Equals(id));

        if (obtainItem != null && obtainItem.itemtype != 0)
        {
            obtainItem.enable = true;
            obtainItem.count += count;
            ItemDatabase.ItemSave(id);
        }
        else
        {
            Item newItem = items.Find(item => item.id == id || item.id.Equals(id));
            if (newItem != null)
            {
                if (newItem.itemtype == 0)
                {
                    Item[] newItems = new Item[count];
                    for (var i = 0; i < count; i++)
                    {
                        Item newCopyItem = newItem.Clone() as Item;
                        newCopyItem.customId = Common.GetRandomItemId(userItems);
                        newCopyItem.enable   = true;
                        newCopyItem.count    = 1;
                        userItems.Add(newCopyItem);
                        newItems[i] = newCopyItem;
                    }
                    MissionSystem.AddClearPoint(MissionSystem.ClearType.CollectEquipment, count);
                    foreach (var item in userItems)
                    {
                        Debugging.Log(item.customId);
                    }
                    ItemDatabase.AddItemListSave(newItems);
                }
                else
                {
                    newItem.customId = Common.GetRandomItemId(userItems);
                    newItem.enable   = true;
                    newItem.count    = count;
                    userItems.Add(newItem);
                    Debugging.Log(newItem.customId);
                    ItemDatabase.AddItemSave(newItem);
                }
            }
        }
    }
예제 #14
0
 public void  GachaClick()
 {
     lastGachaOpen = (ulong)DateTime.Now.Ticks;
     if (type == 0)
     {
         PlayerPrefs.SetString("LastGachaOpen", lastGachaOpen.ToString());
         MissionSystem.AddClearPoint(MissionSystem.ClearType.FreeGacha);
         MissionSystem.AddClearPoint(MissionSystem.ClearType.Gacha);
     }
     else
     {
         PlayerPrefs.SetString("LastCrystalOpen", lastGachaOpen.ToString());
     }
     gachaButton.interactable = false;
     if (buttonScript != null)
     {
         buttonScript.enabled = false;
     }
 }
예제 #15
0
    public void OnClickRewardButton(int id)
    {
        Mission mission = MissionSystem.GetUserMission(id);

        if (mission != null && mission.enable && !mission.clear)
        {
            MissionSystem.ClearMission(id);
            MissionSystem.RewardType rewardType = (MissionSystem.RewardType)mission.rewardType;

            switch (rewardType)
            {
            case MissionSystem.RewardType.coin:
                SaveSystem.AddUserCoin(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(0), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Coin"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.crystal:
                SaveSystem.AddUserCrystal(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(1), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Crystal"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.energy:
                SaveSystem.AddUserEnergy(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(2), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Energy"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.scroll:
                ItemSystem.SetObtainItem(mission.rewardItemId, mission.rewardItemCount);
                Item rewardItem = ItemSystem.GetItem(mission.rewardItemId);
                UI_Manager.instance.ShowGetAlert(rewardItem.image, string.Format("<color='yellow'>{0}</color> {1}", rewardItem.name, LocalizationManager.GetText("alertGetMessage3")));
                break;
            }
        }
        else
        {
            Debugging.Log(id + " 의 미션클리어 실패");
        }
        RefreshUI();
    }
예제 #16
0
    IEnumerator StartEvolution()
    {
        yield return(new WaitForEndOfFrame());

        //ItemSystem.UseEquipmentItem(targetItem.customId, 1);
        targetItemSlotImage.GetComponent <AiryUIAnimatedElement>().HideElement();
        yield return(new WaitForSeconds(0.1f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.equip);
        ItemSystem.UseItem(targetItem.customId, 1);
        matItemSlotImage1.GetComponent <AiryUIAnimatedElement>().HideElement();
        matItemSlotImage2.GetComponent <AiryUIAnimatedElement>().HideElement();
        foreach (var i in matItems.Values)
        {
            ItemSystem.UseItem(i.customId, 1);
            yield return(new WaitForSeconds(0.1f));
        }
        yield return(new WaitForSeconds(0.5f));

        EffectManager.SkillUpgradeEffect(resultItemSlot.transform);
        yield return(new WaitForSeconds(0.3f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.dropItem);
        ItemSystem.SetObtainItem(ItemSystem.GetNextClassItemId(targetItem));
        resultItem = ItemSystem.GetItem(ItemSystem.GetNextClassItemId(targetItem));
        resultItemSlotImage.GetComponent <AiryUIAnimatedElement>().ShowElement();

        Debugging.Log("합성성공!");
        MissionSystem.AddClearPoint(MissionSystem.ClearType.EquipUpgrade);
        targetItem = null;
        matItems.Clear();
        evolutionButton.interactable = true;
        isEndEvolution = true;
        RefreshUI();
        yield return(null);
    }
예제 #17
0
 void OnDestroy()
 {
     OnInit    = null;
     _instance = null;
 }
예제 #18
0
    IEnumerator RandomSelectAbility(int useItemAmount)
    {
        isSelectStart = true;
        int   index     = 0;
        int   tempIndex = 0;
        float time      = 0;

        UI_Manager.instance.PopupInterActiveCover.SetActive(true);
        Random.InitState(User.gachaSeed);
        int selectedIndex = Random.Range(0, abilitySlotList.Count);

        User.gachaSeed = Random.Range(0, 1000);
        SelectImage.GetComponent <Image>().enabled = true;
        while (time < 1)
        {
            tempIndex = Random.Range(0, abilitySlotList.Count);
            if (tempIndex == index)
            {
                index = Mathf.Clamp(tempIndex + 1, 0, abilitySlotList.Count - 1);
            }
            else
            {
                index = tempIndex;
            }
            SelectImage.transform.SetParent(abilitySlotList[index].transform);
            SelectImage.transform.localPosition = Vector3.zero;
            SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
            yield return(new WaitForSeconds(Mathf.Clamp(1.0f - (time * 2), 0.1f, 1)));

            time += 0.05f;
        }
        while (index == selectedIndex)
        {
            index += 1;
            if (index > abilitySlotList.Count - 1)
            {
                index = 0;
            }
            SelectImage.transform.SetParent(abilitySlotList[index].transform);
            SelectImage.transform.localPosition = Vector3.zero;
            SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
            yield return(new WaitForSeconds(0.1f));
        }
        SelectImage.transform.SetParent(abilitySlotList[selectedIndex].transform);
        SelectImage.transform.localPosition = Vector3.zero;
        yield return(new WaitForSeconds(0.3f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop);
        UI_Manager.instance.PopupInterActiveCover.SetActive(false);
        SelectImage.GetComponent <Image>().enabled = false;
        isSelectStart = false;

        if (ItemSystem.UseItem(ItemSystem.GetUserScroll().customId, useItemAmount))
        {
            AbilitySystem.SetObtainAbility(abilityList[selectedIndex].id);
            MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalUseScroll, useItemAmount);
            RefreshUI();
            UI_Manager.instance.PopupGetAbility(abilityList[selectedIndex]);
        }
        else
        {
            RefreshUI();
        }
        yield return(null);
    }
예제 #19
0
    void LoadMissions(List <Mission> missions, Transform parent)
    {
        foreach (var mission in missions)
        {
            GameObject missionSlot = Instantiate(slotMissionPrefab, parent);
            missionImage           = missionSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>();
            missionTitleText       = missionSlot.transform.GetChild(1).GetChild(1).GetComponentInChildren <Text>();
            missionDescriptionText = missionSlot.transform.GetChild(1).GetChild(0).GetComponent <Text>();
            missionSlider          = missionSlot.transform.GetChild(1).GetComponentInChildren <Slider>();
            missionSliderText      = missionSlider.GetComponentInChildren <Text>();
            rewardItemImage        = missionSlot.transform.GetChild(2).GetChild(1).GetComponent <Image>();
            rewardItemCountText    = rewardItemImage.GetComponentInChildren <Text>();
            rewardButton           = missionSlot.transform.GetChild(2).GetComponentInChildren <Button>();
            clearPanel             = missionSlot.transform.GetChild(3).gameObject;

            missionImage.sprite = MissionSystem.GetMissionImage(mission);
            if (mission.missionType == 2)
            {
                missionTitleText.text = MissionSystem.GetMissionName(mission.id) + string.Format(" {0} {1}", (mission.missionLevel + 1), LocalizationManager.GetText("MissionLevel"));
            }
            else
            {
                missionTitleText.text = MissionSystem.GetMissionName(mission.id);
            }
            missionDescriptionText.text = MissionSystem.GetMissionDescription(mission.id);
            missionSliderText.text      = string.Format(" ({0}/{1})", mission.point, mission.clearPoint);
            missionSlider.value         = ((float)mission.point / (float)mission.clearPoint);
            if (mission.rewardType == 3)
            {
                rewardItemImage.sprite = ItemSystem.GetItemImage(mission.rewardItemId);
            }
            else
            {
                rewardItemImage.sprite = Resources.Load <Sprite>(Common.GetCoinCrystalEnergyImagePath(mission.rewardType));
            }
            rewardItemCountText.text = "x " + Common.GetThousandCommaText(mission.rewardItemCount);
            int missionid = mission.id;
            rewardButton.onClick.RemoveAllListeners();
            rewardButton.onClick.AddListener(delegate
            {
                OnClickRewardButton(missionid);
            });
            if (mission.clear)
            {
                rewardButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("missionClear");
                rewardButton.interactable = false;
                clearPanel.SetActive(true);
            }
            else
            {
                clearPanel.SetActive(false);
                if (mission.enable)
                {
                    rewardButton.interactable = true;
                    rewardButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("missionReward");
                }
                else
                {
                    rewardButton.interactable = false;
                    rewardButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("missionProgress");
                }
            }
            missionSlot.SetActive(true);
        }
    }
예제 #20
0
    // Use this for initialization
    void Start()
    {
        dataFolder = Application.dataPath+"/" + GData.dataResultsPath;
        Debug.Log("dataFolder:"+dataFolder);

        // setup play mode
        if (playMode == GData.PlayMode.Read_From_GData)
        {
            playMode = GData.playMode;
        }
        else
        {
            GData.playMode = playMode;
        }

        missionSys = GameObject.FindObjectOfType<MissionSystem>();

        mainUI = GameObject.FindObjectOfType<MainUI>();

        // according to the play mode, select a data collecter
        switch (playMode)
        {
        case GData.PlayMode.Free_Style:
        {
            db = ScriptableObject.CreateInstance<DataBase>();

            mainUI.mission_description.text
                = "<size=24><b>Mission Description:</b></size>\n" +
                    "        Free Looking.";

            string str = "<b>Free Looking</b>\n" ;
                //+ "Please go back to Main Menu by Ctrl + U.";
            mainUI.SetTips(str);
            }
            break;

        }
    }
예제 #21
0
    bool Save()
    {
        bool paSaved       = false;
        bool bagSaved      = false;
        bool skillSaved    = false;
        bool missionSaved  = false;
        bool shortcutSaved = false;

        try
        {
            using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
            {
                Debug.Log("DB Connection Start");

                connection.Open();
                StringBuilder sb = new StringBuilder();

                //Save Player Attribute
                sb.Append("Update Player Set PlayerLevel = " + player.currentLevel.ToString() + ", PlayerName = '" + player.playerName + "', Exp = " + player.currentExp.ToString() +
                          ", STR = " + player.str.ToString() + ", _Int = " + player._int.ToString() + ", Agi = " + player.agi.ToString() +
                          ", AVBLPOINT = " + player.AvailablePoint.ToString() + ", SKILLPOINT = " + player.SkillPoint.ToString() + ", Job = '" + player.job.ToString() + "' WHERE ID = '" + id + "'");
                string attribute = sb.ToString();
                using (SqlCommand command = new SqlCommand(attribute, connection))
                {
                    if (command.ExecuteNonQuery() > 0)
                    {
                        Debug.Log("Player Attribute Save Success");
                        paSaved = true;
                    }

                    /*else
                     * {
                     *  command.ExecuteReader();
                     * }*/
                }
                sb.Remove(0, sb.Length);

                //Save Player Bag
                sb.Append("Update Bag Set ");
                bool        isFirst = true;
                Equipment[] eqArray = Bag.transform.GetChild(1).GetComponent <ArmedEquipment>().equipmentList;
                for (int i = 0; i < eqArray.Length; i++)
                {
                    if (!isFirst)
                    {
                        sb.Append(", ");
                    }
                    switch (i)
                    {
                    case 0:
                        if (eqArray[i] != null)
                        {
                            sb.Append("Head = " + eqArray[i].id);
                        }
                        else
                        {
                            sb.Append("Head = -1");
                        }
                        break;

                    case 1:
                        if (eqArray[i] != null)
                        {
                            sb.Append("Weapon = " + eqArray[i].id);
                        }
                        else
                        {
                            sb.Append("Weapon = -1");
                        }
                        break;

                    case 2:
                        if (eqArray[i] != null)
                        {
                            sb.Append("Body = " + eqArray[i].id);
                        }
                        else
                        {
                            sb.Append("Body = -1");
                        }
                        break;

                    case 3:
                        if (eqArray[i] != null)
                        {
                            sb.Append("Hand = " + eqArray[i].id);
                        }
                        else
                        {
                            sb.Append("Hand = -1");
                        }
                        break;

                    case 4:
                        if (eqArray[i] != null)
                        {
                            sb.Append("Leg = " + eqArray[i].id);
                        }
                        else
                        {
                            sb.Append("Leg = -1");
                        }
                        break;
                    }
                    isFirst = false;
                }
                List <Item> itemList = Bag.transform.GetChild(2).GetComponent <Bag>().itemList;
                for (int i = 0; i < 24; i++)
                {
                    if (!isFirst)
                    {
                        sb.Append(", ");
                    }
                    if (i < itemList.Count)
                    {
                        sb.Append(string.Format("Storage_{0}_ID = {1}, ", i + 1, itemList[i].id.ToString()));
                        sb.Append(string.Format("Storage_{0}_Unit = {1}", i + 1, itemList[i].unit.ToString()));
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(string.Format("Storage_{0}_ID = -1, ", i + 1));
                        sb.Append(string.Format("Storage_{0}_Unit = -1", i + 1));
                        isFirst = false;
                    }
                }
                sb.Append(", Money = " + Bag.transform.GetChild(2).GetComponent <Bag>().coin.unit.ToString());
                sb.Append(" Where ID = 1");
                string bag = sb.ToString();
                using (SqlCommand command = new SqlCommand(bag, connection))
                {
                    if (command.ExecuteNonQuery() > 0)
                    {
                        Debug.Log("Bag Save Success");
                        bagSaved = true;
                    }
                }
                sb.Remove(0, sb.Length);
                isFirst = true;

                //Save SKill
                sb.Append("Update Skill Set ");

                for (int i = 0; i < player.Skill.Length; i++)
                {
                    if (!isFirst)
                    {
                        sb.Append(", ");
                    }
                    sb.Append(string.Format("Skill_{0}_Point = {1}", i + 1, player.Skill[i]));
                    isFirst = false;
                }
                sb.Append(" Where ID = 1");
                string skill = sb.ToString();
                using (SqlCommand command = new SqlCommand(skill, connection))
                {
                    if (command.ExecuteNonQuery() > 0)
                    {
                        Debug.Log("Skill Save Success");
                        skillSaved = true;
                    }
                }
                sb.Remove(0, sb.Length);
                isFirst = true;

                //Save Shortcut
                sb.Append("Update Shortcut Set ");
                GameObject[] temp = Shortcut.GetComponent <Shortcut>().ShortCutArray;
                for (int i = 0; i < temp.Length; i++)
                {
                    if (!isFirst)
                    {
                        sb.Append(", ");
                    }
                    if (temp[i].transform.childCount > 0)
                    {
                        sb.Append(string.Format("Shortcut_{0}_ID = {1}", i + 1, temp[i].transform.GetChild(0).GetComponent <DragAndDropItem>().ItemId));
                    }
                    else
                    {
                        sb.Append(string.Format("Shortcut_{0}_ID = -1", i + 1));
                    }
                    isFirst = false;
                }
                sb.Append(" Where ID = 1");
                string shortcut = sb.ToString();
                using (SqlCommand command = new SqlCommand(shortcut, connection))
                {
                    if (command.ExecuteNonQuery() > 0)
                    {
                        Debug.Log("Shortcut Save Success");
                        shortcutSaved = true;
                    }
                }
                sb.Remove(0, sb.Length);
                isFirst = true;

                //Save Mission
                sb.Append("Update Mission Set ");
                MissionSystem ms = GameManager.player.GetComponent <MissionSystem>();
                for (int i = 0; i < ms.mission.Length; i++)
                {
                    if (!isFirst)
                    {
                        sb.Append(", ");
                    }
                    sb.Append(string.Format("Mission_{0}_progress = {1}", i + 1, ms.mission[i].Getcomplete() ? 1 : 0));
                    isFirst = false;
                }
                sb.Append(" Where ID = 1");
                string mission = sb.ToString();
                using (SqlCommand command = new SqlCommand(mission, connection))
                {
                    if (command.ExecuteNonQuery() > 0)
                    {
                        Debug.Log("Mission Save Success");
                        missionSaved = true;
                    }
                }
                sb.Remove(0, sb.Length);

                connection.Close();
                Debug.Log("DB Connection End");
            }
        }
        catch (SqlException e)
        {
            Debug.Log(e.ToString());
        }

        return(paSaved && bagSaved && skillSaved && shortcutSaved && missionSaved);
    }
예제 #22
0
 public bool HasEndedTurn()
 {
     return(MissionSystem.HasCompletedGlobal("find_enemy"));
 }
예제 #23
0
 void Press_OnClick()
 {
     SetChoose();
     MissionSystem.GetInstance()._MissionSystemMain._MissionSystemCell.SetHide();
     MissionSystem.GetInstance()._MissionSystemMain._MissionSystemCell = this;
 }
예제 #24
0
    void MissionParser(SqlDataReader reader)
    {
        MissionSystem ms = player.gameObject.GetComponent <MissionSystem>();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            if (reader.GetValue(i) != null)
            {
                switch (reader.GetName(i).ToLower())
                {
                case "mission_1_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[0].Setcomplete(true);
                        ms.MissionStart(1);
                    }
                    break;

                case "mission_2_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[1].Setcomplete(true);
                        ms.MissionStart(2);
                    }
                    break;

                case "mission_3_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[2].Setcomplete(true);
                        ms.MissionStart(3);
                    }
                    break;

                case "mission_4_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[3].Setcomplete(true);
                        ms.MissionStart(4);
                    }
                    break;

                case "mission_5_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[4].Setcomplete(true);
                        ms.MissionStart(5);
                    }
                    break;

                case "mission_6_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[5].Setcomplete(true);
                        ms.MissionStart(6);
                    }
                    break;

                case "mission_7_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[6].Setcomplete(true);
                        ms.MissionStart(7);
                    }
                    break;

                case "mission_8_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[7].Setcomplete(true);
                        ms.MissionStart(8);
                    }
                    break;

                case "mission_9_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[8].Setcomplete(true);
                        ms.MissionStart(9);
                    }
                    break;

                case "mission_10_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[9].Setcomplete(true);
                        ms.MissionStart(10);
                    }
                    break;

                case "mission_11_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[10].Setcomplete(true);
                        ms.MissionStart(11);
                    }
                    break;

                case "mission_12_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[11].Setcomplete(true);
                        ms.MissionStart(12);
                    }
                    break;

                case "mission_13_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[12].Setcomplete(true);
                        ms.MissionStart(13);
                    }
                    break;

                case "mission_14_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[13].Setcomplete(true);
                        ms.MissionStart(14);
                    }
                    break;

                case "mission_15_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[14].Setcomplete(true);
                        ms.MissionStart(15);
                    }
                    break;

                case "mission_16_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[15].Setcomplete(true);
                        ms.MissionStart(16);
                    }
                    break;

                case "mission_17_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[16].Setcomplete(true);
                        ms.MissionStart(17);
                    }
                    break;

                case "mission_18_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[17].Setcomplete(true);
                        ms.MissionStart(18);
                    }
                    break;

                case "mission_19_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[18].Setcomplete(true);
                        ms.MissionStart(19);
                    }
                    break;

                case "mission_20_progress":
                    if (reader.GetBoolean(i) != false)
                    {
                        ms.mission[19].Setcomplete(true);
                    }
                    break;
                }
            }
        }
    }
예제 #25
0
 public QuestAttr(MissionSystem questAttr, int id)
 {
     this.questAttr = questAttr;
     this.id        = id;
 }