Esempio n. 1
0
    void OnPopupOk(StoreConfirmParam parm)
    {
        C2G.StoreItemBuy packet = new C2G.StoreItemBuy();

        packet.store_id  = m_StoreID;
        packet.store_idx = m_StoreItem.store_idx;

        switch (m_StoreItem.item_type)
        {
        case pe_StoreItemType.Rune:
            RuneInfo rune_info = ItemInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn) as RuneInfo;
            packet.rune_id = rune_info.ID;
            break;

        case pe_StoreItemType.Token:
            packet.goods = new pd_GoodsData((ItemInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn) as TokenInfo).TokenType, m_StoreItem.item_count);
            break;

        case pe_StoreItemType.Creature:
            packet.creature_id    = CreatureInfoManager.Instance.GetInfoByIdn(m_StoreItem.item_idn).ID;
            packet.creature_grade = m_StoreItem.item_count;
            break;

        default:
            break;
        }

        Network.GameServer.JsonAsync <C2G.StoreItemBuy, C2G.StoreItemBuyAck>(packet, OnStoreItemBuy);
    }
Esempio n. 2
0
    void OnStoreItemBuy(C2G.StoreItemBuy packet, C2G.StoreItemBuyAck ack)
    {
        m_StoreItem.buying_state = 1;
        m_Purchased.SetActive(m_StoreItem.buying_state > 0);

        if (ack.loot_rune != null)
        {
            RuneManager.Instance.Add(ack.loot_rune);
        }
        else if (packet.goods != null)
        {
            Network.PlayerInfo.AddGoods(packet.goods);
        }
        else if (ack.loot_creature != null)
        {
            Network.Instance.LootCreature(ack.loot_creature);
            Popup.Instance.Show(ePopupMode.LootCharacter, ack.loot_creature.creature.creature_idx, false, true);
        }
        else
        {
            ItemManager.Instance.Add(m_StoreItem);

            //while (ItemManager.Instance.ItemMadeList.Count > 0)
            //{
            //    Tooltip.Instance.ShowItemMade(ItemManager.Instance.ItemMadeList[0].item.Info);
            //    ItemManager.Instance.ItemMadeList.RemoveAt(0);
            //}
            ItemManager.Instance.ItemMadeList.Clear();
        }

        Network.PlayerInfo.UseGoods(m_StoreItem.price);
        GameMain.Instance.UpdatePlayerInfo();
        GameMain.Instance.UpdateMenu();

        Tooltip.Instance.ShowMessageKey("SuccessPurchased");
    }