コード例 #1
0
    public void OnMakeStuff()
    {
        var make_item_info = ItemManager.Instance.GetItemByID(m_Info.MakeID);

        if (make_item_info.Count < m_Info.MakeCount)
        {
            return;
        }
        C2G.StuffMake packet = new C2G.StuffMake();
        packet.item_idn = m_Info.IDN;
        Network.GameServer.JsonAsync <C2G.StuffMake, C2G.StuffMakeAck>(packet, OnStuffMakeHandler);
    }
コード例 #2
0
    void OnStuffMakeHandler(C2G.StuffMake packet, C2G.StuffMakeAck ack)
    {
        var make_item_info = ItemManager.Instance.GetItemByID(m_Info.MakeID);

        if (make_item_info == null)
        {
            make_item_info = new Item(ItemInfoManager.Instance.GetInfoByID(m_Info.MakeID));
        }

        if (m_Item == null)
        {
            m_Item = new Item(m_Info);
            ItemManager.Instance.Add(m_Item);
        }

        m_Item.AddCount(1);
        make_item_info.AddCount((short)-m_Info.MakeCount);
        GameMain.Instance.UpdateMenu();
        Init();
    }