示例#1
0
 void OnLootCreature10(C2G.LootCreature10 packet, C2G.LootCreature10Ack ack)
 {
     Debug.Log("OnLootCreature10");
     Network.PlayerInfo.UseGoods(m_ItemLoot.Price);
     ack.loots.ForEach(c => Network.Instance.LootCreature(c));
     Popup.Instance.Show(ePopupMode.LootCharacter10, ack, this);
     GameMain.Instance.UpdatePlayerInfo();
 }
示例#2
0
    void OnPopupOk(StoreConfirmParam parm)
    {
        if (m_ItemLoot != null)
        {
            long price = Network.PlayerInfo.GetGoodsValue(m_ItemLoot.Price.goods_type);
            if (m_Free.activeInHierarchy == false && m_ItemLoot.Price.goods_value > price)
            {
                Popup.Instance.Show(ePopupMode.MoveStore, m_ItemLoot.Price.goods_type);
                return;
            }
            switch (m_ItemLoot.LootType)
            {
            case "LootHero":
            {
                if (Network.Instance.CheckCreatureSlotCount(m_ItemLoot.LootCount, true, true, OnLootMore) == false)
                {
                    return;
                }

                if (m_ItemLoot.LootCount == 1)
                {
                    C2G.LootCreature packet = new C2G.LootCreature();
                    packet.loot_id = m_ItemLoot.ID;
                    packet.is_free = m_Free.activeSelf;
                    if (Tutorial.Instance.Completed == false)
                    {
                        C2G.TutorialState tutorial_packet = new C2G.TutorialState();
                        tutorial_packet.tutorial_state      = (short)Tutorial.Instance.CurrentState;
                        tutorial_packet.next_tutorial_state = (short)Tutorial.Instance.NextState;
                        tutorial_packet.loot_creature       = packet;
                        Network.GameServer.JsonAsync <C2G.TutorialState, C2G.TutorialStateAck>(tutorial_packet, OnTutorialLootCreature);
                    }
                    else
                    {
                        Network.GameServer.JsonAsync <C2G.LootCreature, C2G.LootCreatureAck>(packet, OnLootCreature);
                    }
                    return;
                }
                else if (m_ItemLoot.LootCount == 10)
                {
                    C2G.LootCreature10 packet = new C2G.LootCreature10();
                    packet.loot_id = m_ItemLoot.ID;
                    Network.GameServer.JsonAsync <C2G.LootCreature10, C2G.LootCreature10Ack>(packet, OnLootCreature10);
                    return;
                }
            }
            break;

            case "LootRune":
            case "LootItem":
            {
                if (m_ItemLoot.LootType == "LootRune" && Network.Instance.CheckRuneSlotCount(m_ItemLoot.LootCount, true, true, OnLootMore) == false)
                {
                    return;
                }

                if (m_ItemLoot.LootCount == 1)
                {
                    C2G.StoreLootItem packet = new C2G.StoreLootItem();
                    packet.loot_id = m_ItemLoot.ID;
                    packet.is_free = m_Free.activeSelf;
                    Network.GameServer.JsonAsync <C2G.StoreLootItem, C2G.StoreLootItemAck>(packet, OnLootItem);
                    return;
                }
                else if (m_ItemLoot.LootCount == 10)
                {
                    C2G.StoreLootItem10 packet = new C2G.StoreLootItem10();
                    packet.loot_id = m_ItemLoot.ID;
                    Network.GameServer.JsonAsync <C2G.StoreLootItem10, C2G.StoreLootItem10Ack>(packet, OnLootItem10);
                    return;
                }
            }
            break;
            }
        }
        else if (m_ItemGoods != null)
        {
            if (m_ItemGoods.StoreID != "Gem")
            {
                long price = Network.PlayerInfo.GetGoodsValue(m_ItemGoods.Price.goods_type);
                if (m_ItemGoods.Price.goods_value > price)
                {
                    Popup.Instance.Show(ePopupMode.MoveStore, m_ItemGoods.Price.goods_type);
                    return;
                }
            }

            C2G.StoreGoodsBuy packet = new C2G.StoreGoodsBuy();

            packet.store_id = m_ItemGoods.StoreID;
            packet.item_id  = m_ItemGoods.ID;

            Network.GameServer.JsonAsync <C2G.StoreGoodsBuy, C2G.StoreGoodsBuyAck>(packet, OnStoreItemBuy);
            return;
        }

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