Exemplo n.º 1
0
    void OnLootItem10(C2G.StoreLootItem10 packet, C2G.StoreLootItem10Ack ack)
    {
        Network.PlayerInfo.UseGoods(m_ItemLoot.Price);
        List <LootItemInfo> loot_item_infos = new List <LootItemInfo>();

        for (int i = 0; i < ack.loot_items.Count; ++i)
        {
            ItemManager.Instance.Add(ack.loot_items[i]);
            loot_item_infos.Add(new LootItemInfo(ack.loot_items[i].item_idn, ack.loot_items[i].add_piece_count));
        }
        for (int i = 0; i < ack.loot_runes.Count; ++i)
        {
            RuneManager.Instance.Add(ack.loot_runes[i]);
            RuneInfo rune_info = RuneInfoManager.Instance.GetRuneInfoByIdn(ack.loot_runes[i].rune_idn);
            loot_item_infos.Add(new LootItemInfo(ack.loot_runes[i].rune_idn, 0, rune_info.Grade > 3));
        }
        loot_item_infos = loot_item_infos.OrderBy(i => MNS.Random.Instance.Next()).ToList();
        //ItemManager.Instance.ItemMadeList.Clear();

        GameMain.Instance.UpdatePlayerInfo();

        Popup.Instance.Show(ePopupMode.LootItem10, loot_item_infos, this);
    }
Exemplo n.º 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");
    }