示例#1
0
    public void BuyMercenary(int _num)
    {
        string        key           = ReadMercenaryDataList[_num].name;
        int           catPrice      = 0;
        MercenaryData mercenaryData = ReadMercenaryDataList[_num];

        if (userData.getMercenaryDataDic.Count > 0 && isGetMercenaryCat(key) == true)
        {
            MercenaryData myMercenary = GetMyMercenaryData(key);
            myMercenary.level = myMercenary.level + 1;
            catPrice          = myMercenary.price;

            SetMyMercenaryData(key, myMercenary);
        }
        else
        {
            mercenaryData.level = mercenaryData.level + 1;
            catPrice            = mercenaryData.price;

            userData.getMercenaryDataDic.Add(key, mercenaryData);
        }

        userData.userCurrency.userCoin = userData.userCurrency.userCoin - catPrice;

        if (0 != catPrice)
        {
            MercenaryData m = GetMyMercenaryData(key);
            SaveGameData(ITEM_TYPE.Gold, userData.userCurrency.userCoin, m.name, m.level);
        }
        else
        {
            MercenaryData m = GetMyMercenaryData(key);
            SaveGameData(ITEM_TYPE.None, 0, m.name, m.level);
        }
    }
示例#2
0
    public void SetCatItem(int _index, MercenaryData _mercenaryData)
    {
        index         = _index;
        mercenaryData = _mercenaryData;

        catName.text    = mercenaryData.name;
        catImage.sprite = mercenaryData.catImage;
        levelText.text  = string.Format("Lv.{0}", mercenaryData.level);
        priceText.text  = string.Format("{0} {1}", mercenaryData.price, "K");

        if (GameDataManager.Instance.userData.leaderData.name == mercenaryData.name)
        {
            isLeader = true;
        }
        else
        {
            isLeader = false;
        }

        if (isLeader == false)
        {
            selectEffect.SetActive(GameDataManager.Instance.isDeckMercenary(mercenaryData));
        }
        else
        {
            selectEffect.SetActive(true);
        }

        if (_mercenaryData.mercenaryGetType == MercenaryGetType.Video)
        {
            buttonList[0].gameObject.SetActive(false);
            buttonList[1].gameObject.SetActive(false);
            buttonList[2].gameObject.SetActive(true);
        }
        else
        {
            if (isLeader == true)
            {
                buttonList[0].gameObject.SetActive(true);
                buttonList[1].gameObject.SetActive(false);
                buttonList[2].gameObject.SetActive(false);
            }
            else
            {
                if (GameDataManager.Instance.isBuyItem(mercenaryData.price) == true)
                {
                    buttonList[0].gameObject.SetActive(true);
                    buttonList[1].gameObject.SetActive(false);
                    buttonList[2].gameObject.SetActive(false);
                }
                else
                {
                    buttonList[0].gameObject.SetActive(false);
                    buttonList[1].gameObject.SetActive(true);
                    buttonList[2].gameObject.SetActive(false);
                }
            }
        }
    }
    private MercenaryData GenerateMercenaryData(MercenaryParameter param, BuildingIdentity campID)
    {
        MercenaryData mercenaryData = new MercenaryData();

        mercenaryData.CampID     = campID;
        mercenaryData.ConfigData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(param.MercenaryType);
        return(mercenaryData);
    }
示例#4
0
        public void AssignData(MercenaryData pData)
        {
            Data = pData;

            NameField.text  = pData.Name;
            RankField.text  = "Rank " + pData.Stats.Rank;
            StatsField.text = pData.Stats.Mind + " / " + pData.Stats.Body + " / " + pData.Stats.Spirit;
            // Portrait.sprite = pData.Portrait;
        }
示例#5
0
    public void SelectMercenary(MercenaryData _mercenaryData)
    {
        if (userData.mercenaryDataList.Count >= 2)
        {
            Debug.LogError("Mercenary Count is Big");
            return;
        }

        userData.mercenaryDataList.Add(_mercenaryData);
    }
示例#6
0
 public void RemoveMercenary(MercenaryData _mercenaryData)
 {
     for (int i = 0; i < userData.mercenaryDataList.Count; i++)
     {
         if (userData.mercenaryDataList[i].name == _mercenaryData.name)
         {
             Debug.Log("Mercenary Remove : " + _mercenaryData.name);
             userData.mercenaryDataList.Remove(userData.mercenaryDataList[i]);
             break;
         }
     }
 }
示例#7
0
    public void ConvertFromOverworld(MercenaryData incData)
    {
        Body          = incData.Stats.Body;
        Mind          = incData.Stats.Mind;
        Spirit        = incData.Stats.Spirit;
        mercInventory = incData.Inventory;

        foreach (Item artifact in incData.Equipment)
        {
            int dBoost = 0, oBoost = 0;
            switch (artifact.Type)
            {
            case ItemType.Armor:
                if (artifact.BasePower > DTier)
                {
                    DTier = artifact.BasePower;
                }
                break;

            case ItemType.Weapon:
                if (artifact.BasePower > OTier)
                {
                    OTier = artifact.BasePower;
                }
                break;

            case ItemType.Trinket:
                if (artifact.name.Contains("defenceboost"))
                {
                    dBoost++;
                }
                if (artifact.name.Contains("attackboost"))
                {
                    oBoost++;
                }
                break;

            case ItemType.Resource:
                break;
            }
            DTier += dBoost;
            OTier += oBoost;
        }
        DTier          = 5;//PLAYTEST GOD-MODE
        OTier          = 5;
        WeaponCohesion = 100;
        ArmourCohesion = 100;

        RecalcStats();
        RecalcSkills();
    }
示例#8
0
    public void HireMercenary(MercenaryIdentity id, BuildingIdentity campID)
    {
        MercenaryData data = new MercenaryData();

        data.CampID     = campID;
        data.ConfigData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(id.mercenaryType);
        MercenaryLogicData logicData = new MercenaryLogicData(data);

        if (!this.m_Mercenaries.ContainsKey(id.mercenaryType))
        {
            this.m_Mercenaries.Add(id.mercenaryType, new Dictionary <int, MercenaryLogicData>());
        }
        this.m_Mercenaries[id.mercenaryType].Add(id.mercenaryNO, logicData);
    }
示例#9
0
        public void UpdateMercInteractionButton(MercenaryData pMercenary)
        {
            bool mercIsOnMission = false;

            foreach (Notification n in NotificationController.Instance.Notifications)
            {
                if (n.Mercenary == pMercenary)
                {
                    mercIsOnMission = true;
                    break;
                }
            }

            SetMissionButton.interactable = !mercIsOnMission;
        }
示例#10
0
    public MercenaryData GetReadMercenaryData(string _name)
    {
        MercenaryData data = new MercenaryData();

        for (int i = 0; i < ReadMercenaryDataList.Count; i++)
        {
            if (ReadMercenaryDataList[i].name == _name)
            {
                data = ReadMercenaryDataList[i];
                break;
            }
        }

        return(data);
    }
示例#11
0
    public bool isDeckMercenary(MercenaryData _mercenaryData)
    {
        bool result = false;

        for (int i = 0; i < userData.mercenaryDataList.Count; i++)
        {
            if (userData.mercenaryDataList[i].name == _mercenaryData.name)
            {
                result = true;
                break;
            }
        }

        return(result);
    }
示例#12
0
        public void SetSelectedMercenary(MercenaryData pMercenary)
        {
            if (selectedMercenary != pMercenary)
            {
                selectedMercenary = pMercenary;

                UpdateMercInteractionButton(pMercenary);

                if (InventoryUIController.Instance.bottomInventoryOpen)
                {
                    BottomInventoryPanel.SetTrigger("SwapSelected");

                    // Load the selected mercenary's data into the inventory panel while it's behind the left panel ui
                    InventoryUIController.Instance.Invoke("LoadMercenaryInventory", 0.075f);
                }
            }
        }
示例#13
0
    public void BuyMercenary(int _num)
    {
        string        key           = ReadMercenaryDataList[_num].name;
        MercenaryData mercenaryData = ReadMercenaryDataList[_num];

        if (userData.getMercenaryDataDic.Count > 0 && isGetMercenaryCat(key) == true)
        {
            MercenaryData myMercenary = GetMyMercenaryData(key);
            myMercenary.level = myMercenary.level + 1;

            SetMyMercenaryData(key, myMercenary);
        }
        else
        {
            mercenaryData.level = mercenaryData.level + 1;

            userData.getMercenaryDataDic.Add(key, mercenaryData);
        }
    }
示例#14
0
    public void InsertMercenary(bool isInsert, MercenaryData _mercenaryData)
    {
        if (isInsert == true)
        {
            if (userData.mercenaryDataList.Count > 2)
            {
                return;
            }

            userData.mercenaryDataList.Add(_mercenaryData);
        }
        else
        {
            for (int i = 0; i < userData.mercenaryDataList.Count; i++)
            {
                if (userData.mercenaryDataList[i].name == _mercenaryData.name)
                {
                    userData.mercenaryDataList.Remove(userData.mercenaryDataList[i]);
                }
            }
        }
    }
示例#15
0
    public void ToggleEquipMousedOverItem()
    {
        // Only equip an item if there isn't a held item
        if (SelectedItem != null)
        {
            return;
        }

        // Only equip an item that's in a mercenary's inventory
        MercenaryData toEquipTo = null;

        foreach (MercenaryData m in MercenaryController.Instance.Mercenaries)
        {
            if (FocusedInventory == m.Inventory)
            {
                toEquipTo = m;
                break;
            }
        }

        // This isn't a mercenary inventory, so return.
        if (toEquipTo == null)
        {
            return;
        }

        Item toEquip = GetMousedOverItem(FocusedGrid);

        // No item was moused over, so return.
        if (toEquip == null)
        {
            return;
        }

        // This item isn't equippable, so return.
        if (!Item.IsEquippable(toEquip))
        {
            return;
        }

        // We can equip or unequip the item. Do it.

        if (toEquip.IsEquipped)
        {
            toEquipTo.UnequipItem(toEquip);
        }
        else
        {
            toEquipTo.EquipItem(toEquip);
        }

        // Update the equipped badge for the correct item UI object
        foreach (ItemObject i in FocusedGrid.GetComponentsInChildren <ItemObject>())
        {
            if (toEquip == i.Data)
            {
                i.UpdateIsEquipped();
                break;
            }
        }

        // Update the power readout
        AppUI.Instance.MercenaryEquipPowerInventory.text = "Equipment Power\n" + AppUI.Instance.SelectedMercenary.Inventory.EquippedPowerLevel + " / " + AppUI.Instance.SelectedMercenary.MaxEquipmentPower;
    }
示例#16
0
 public void SetMyMercenaryData(string _name, MercenaryData _mercenaryData)
 {
     userData.getMercenaryDataDic[_name] = _mercenaryData;
 }
示例#17
0
 public MercenaryLogicData(MercenaryData data)
 {
     this.m_Data = data;
 }
示例#18
0
    private void STocLoadGameDataReply(object data)
    {
        LoadGameDataReply reply = data as LoadGameDataReply;

        if (ERROR_CODE.Ok == reply.Error)
        {
            Debug.Log("Ok");

            foreach (var item in reply.Items)
            {
                switch (item.ItemType)
                {
                case ITEM_TYPE.Gold:
                    GameDataManager.Instance.userData.userCurrency.userCoin = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.Ruby:
                    GameDataManager.Instance.userData.userCurrency.userRubby = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.PieceKnight:
                    GameDataManager.Instance.userData.userCurrency.knightPiece = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.PiecePirate:
                    GameDataManager.Instance.userData.userCurrency.piratePiece = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.PieceStar:
                    GameDataManager.Instance.userData.userCurrency.starPiece = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.PieceScientist:
                    GameDataManager.Instance.userData.userCurrency.scientistPiece = (int)item.ItemCount;
                    break;

                case ITEM_TYPE.PieceStudent:
                    GameDataManager.Instance.userData.userCurrency.studentPiece = (int)item.ItemCount;
                    break;
                }
            }

            if (null != GameDataManager.Instance.userData.getMercenaryDataDic)
            {
                GameDataManager.Instance.userData.getMercenaryDataDic.Clear();

                foreach (var mercenary in reply.Mercenaries)
                {
                    MercenaryData mercenaryData = new MercenaryData();
                    mercenaryData.name  = mercenary.MercenaryName;
                    mercenaryData.level = mercenary.MercenaryLevel;

                    MercenaryData readData = GameDataManager.Instance.GetReadMercenaryData(mercenary.MercenaryName);
                    mercenaryData.damage            = readData.damage;
                    mercenaryData.moveSpeed         = readData.moveSpeed;
                    mercenaryData.attackSpeed       = readData.attackSpeed;
                    mercenaryData.catImage          = readData.catImage;
                    mercenaryData.bulletImage       = readData.bulletImage;
                    mercenaryData.mercenaryGetType  = readData.mercenaryGetType;
                    mercenaryData.price             = readData.price;
                    mercenaryData.runtimeAnimator   = readData.runtimeAnimator;
                    mercenaryData.uiRuntimeAnimator = readData.uiRuntimeAnimator;

                    GameDataManager.Instance.userData.getMercenaryDataDic.Add(
                        mercenary.MercenaryName, mercenaryData);
                }
            }

            GameDataManager.Instance.userData.stageNum = reply.Stage.StageNum;
            GameDataManager.Instance.userData.score    = (int)reply.Stage.StageScore;

            GameDataManager.Instance.userData.upgradePlayer.powerLevel        = reply.UpgradePlayer.PowerLevel;
            GameDataManager.Instance.userData.upgradePlayer.attackSpeedLevel  = reply.UpgradePlayer.AttackSpeedLevel;
            GameDataManager.Instance.userData.upgradePlayer.criticalLevel     = reply.UpgradePlayer.CriticalLevel;
            GameDataManager.Instance.userData.upgradePlayer.buffDurationLevel = reply.UpgradePlayer.BuffDurationLevel;
            GameDataManager.Instance.userData.upgradePlayer.freeCoinLevel     = reply.UpgradePlayer.FreeCoinLevel;

            //GameObject gameObject = GameObject.Find("LobbyCanvas(Clone)");
            //gameObject.SendMessage("UpdateCoinText");
            //gameObject.SendMessage("UpdateScoreText");
            UIManager.Instance.lobbyUI.UpdateCoinText();
            UIManager.Instance.lobbyUI.UpdateScoreText();
            //shopController.SetCatShopList();
            //UIManager.Instance.lobbyUI.shopController.RefreshCatShopList();
        }
        else
        {
            Debug.Log(reply.Error);
        }
    }