Ejemplo n.º 1
0
    public void OnReceiveUseItemPacket(int node, PacketId id, byte[] data)
    {
        ItemUsePacket packet  = new ItemUsePacket(data);
        ItemUseData   useData = packet.GetPacket();

        Debug.Log("Receive UseItemPacket:" + useData.userId + " -> " +
                  useData.targetId + " (" + useData.itemCategory + ")");

        chrController user = CharacterRoot.getInstance().findPlayer(useData.userId);

        AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id);

        if (user != null && account_data.avator_id != useData.userId)
        {
            Debug.Log("use item. favor:" + useData.itemFavor);

            Item.Favor favor = new Item.Favor();
            favor.category = (Item.CATEGORY)useData.itemCategory;
            this.useItem(-1, favor, useData.userId, useData.targetId, false);
        }
        else
        {
            Debug.Log("Receive packet is already done.");
        }
    }
Ejemplo n.º 2
0
    // 아이템을 설정한다(아이콘을 표시한다).
    public void             setItem(Item.SLOT_TYPE slot, int slot_index, Item.Favor favor)
    {
        switch (slot)
        {
        //방 열쇠..
        case Item.SLOT_TYPE.KEY:
        {
            this.sprite_key[slot_index].setTexture(this.item_icon_keys[slot_index]);
            this.sprite_key[slot_index].setVisible(this.is_active);
        }
        break;

        // 플로어 이동 도어 열쇠.
        case Item.SLOT_TYPE.FLOOR_KEY:
        {
            this.sprite_floor_key.setTexture(this.item_icon_keys[(int)Item.KEY_COLOR.PURPLE]);
            this.sprite_floor_key.setVisible(this.is_active);
        }
        break;

        case Item.SLOT_TYPE.CANDY:
        {
            this.sprite_candy.setTexture(this.item_icon_candy);
            this.sprite_candy.setVisible(this.is_active);
        }
        break;

        case Item.SLOT_TYPE.MISC:
        {
            this.sprite_miscs[slot_index].setTexture(this.item_icon_ice);
            this.sprite_miscs[slot_index].setVisible(this.is_active);
        }
        break;
        }
    }
Ejemplo n.º 3
0
    // 자신에게 아이템을 사용한다.
    public void             cmdUseItemSelf(int slot, Item.Favor item_favor, bool is_local)
    {
        // 이 부분은 ItemWindow 등에서 아이템을 사용하고 싶을 때.
        // 호출하는 메소드다.

        string account_id = AccountManager.get().getAccountData(this.global_index).account_id;

        ItemManager.getInstance().useItem(slot, item_favor, account_id, account_id, is_local);
    }
Ejemplo n.º 4
0
    // 동료에게 아이템을 사용한다.
    public void             cmdUseItemToFriend(Item.Favor item_favor, int friend_global_index, bool is_local)
    {
        // 이 부분은 ItemWindow 등에서 아이템을 사용하고 싶을 때.
        // 호출하는 메시지다.

        string account_id        = AccountManager.get().getAccountData(this.global_index).account_id;
        string friend_account_id = AccountManager.get().getAccountData(friend_global_index).account_id;

        ItemManager.getInstance().useItem(-1, item_favor, account_id, friend_account_id, is_local);
    }
Ejemplo n.º 5
0
    // ?꾩씠?쒖쓣 ?ъ슜?덉쓣 ???몄텧?쒕떎.
    public override void            onUseItem(int slot, Item.Favor favor)
    {
        base.onUseItem(slot, favor);

        this.step_use_item.player     = this;
        this.step_use_item.slot_index = slot;
        this.step_use_item.item_favor = favor;

        this.step.set_next(STEP.USE_ITEM);
    }
Ejemplo n.º 6
0
 //  아이템을 사용해 주었을 때(동료가 자신에게) 호출된다.
 public virtual void             onUseItemByFriend(Item.Favor favor, chrBehaviorPlayer friend)
 {
     switch (favor.category)
     {
     case Item.CATEGORY.SODA_ICE:
     {
         this.skin_color_control.startHealing();
     }
     break;
     }
 }
Ejemplo n.º 7
0
    public void SendItemUseData(Item.Favor item_favor, string user_name, string target_name)
    {
        ItemUseData data = new ItemUseData();

        Debug.Log("[CLIENT] SendItemUseData: user:"******" target:" + target_name);
        dbwin.console().print("[CLIENT] SendItemUseData: user:"******" target:" + target_name);

        data.userId       = user_name;
        data.targetId     = target_name;
        data.itemCategory = (int)item_favor.category;

        ItemUsePacket packet = new ItemUsePacket(data);

        if (m_network != null)
        {
            int serverNode = m_network.GetServerNode();
            m_network.SendReliable <ItemUseData>(serverNode, packet);
        }
    }
Ejemplo n.º 8
0
    // 아이템을 사용한다(스스로 자신에게).
    public void             onUseItemSelf(int slot_index, Item.Favor favor)
    {
        // 이 부분은 실제로 아이템을 사용할 때 아이템 매니저에서.
        // 호출되는 메소드다.

        var player = this.behavior as chrBehaviorPlayer;

        switch (favor.category)
        {
        case Item.CATEGORY.SODA_ICE:
        {
            if (player != null)
            {
                player.onUseItem(slot_index, favor);
            }
        }
        break;
        }
    }
Ejemplo n.º 9
0
    // 아이템을 사용했다(동려가 자신에게).
    //
    // in:	friend	아이템을 사용한 동료.
    //
    public void             onUseItemByFriend(Item.Favor favor, chrController friend)
    {
        // 이 부분은 실제로 아이템을 사용할 때 아이템 매니저에서.
        // 호출되는 메소드다.

        var player = this.behavior as chrBehaviorPlayer;

        switch (favor.category)
        {
        case Item.CATEGORY.SODA_ICE:
        {
            //this.vital.healFull();

            if (player != null)
            {
                player.onUseItemByFriend(favor, friend.behavior as chrBehaviorPlayer);
            }
        }
        break;
        }
    }
Ejemplo n.º 10
0
    // 아이템 사용.
    public void             useItem(int slot_index, Item.Favor item_favor, string user_name, string target_name, bool is_local)
    {
        do
        {
            chrController user = CharacterRoot.getInstance().findPlayer(user_name);

            if (user == null)
            {
                break;
            }

            chrController target = CharacterRoot.getInstance().findPlayer(target_name);

            if (target == null)
            {
                break;
            }

            //

            if (user_name == PartyControl.get().getLocalPlayer().getAcountID())
            {
                user.onUseItemSelf(slot_index, item_favor);
            }
            else
            {
                target.onUseItemByFriend(item_favor, user);
            }

            // 아이템 사용을 알림.
            if (is_local)
            {
                SendItemUseData(item_favor, user_name, target_name);
            }
        } while(false);
    }
Ejemplo n.º 11
0
 public void             setItemSlotAndFavor(int slot, Item.Favor item_favor)
 {
     this.slot_index = slot;
     this.item_favor = item_favor;
 }
Ejemplo n.º 12
0
    // ================================================================ //


    // 생성 직후에 호출.
    public void     initialize()
    {
        this.item_favor   = new Item.Favor();
        this.preset_texts = new List <string>();

        this.is_texts_editable = true;
        this.initialize_item();
        this.is_texts_editable = false;

        switch (this.controll.type)
        {
        case "candy00":
        {
            this.item_favor.category = Item.CATEGORY.CANDY;
        }
        break;

        case "key00":
        case "key01":
        case "key02":
        case "key03":
        {
            this.item_favor.category = Item.CATEGORY.KEY;
            break;
        }

        case "key04":
        {
            this.item_favor.category = Item.CATEGORY.FLOOR_KEY;
            break;
        }

        case "ice00":
        {
            this.item_favor.category = Item.CATEGORY.SODA_ICE;
            this.item_favor.option0  = (object)false;
        }
        break;

        case "cake00":
        {
            this.item_favor.category = Item.CATEGORY.FOOD;
        }
        break;

        case "shot_negi":
        case "shot_yuzu":
        {
            this.item_favor.category = Item.CATEGORY.WEAPON;
        }
        break;


        case "dagger00":
        {
            this.item_favor.category = Item.CATEGORY.WEAPON;
        }
        break;

        case "arrow00":
        {
            this.item_favor.category = Item.CATEGORY.WEAPON;
        }
        break;

        case "bomb00":
        {
            this.item_favor.category = Item.CATEGORY.ETC;
        }
        break;
        }
    }
Ejemplo n.º 13
0
	public void		setItemSlotAndFavor(int slot, Item.Favor item_favor)
	{
		this.slot_index = slot;
		this.item_favor = item_favor;
	}
Ejemplo n.º 14
0
 // 초기화.
 public void     initialize()
 {
     this.item_id  = "";
     this.favor    = null;
     this.is_using = false;
 }
Ejemplo n.º 15
0
	// ================================================================ //


	// 생성 직후에 호출.
	public void	initialize()
	{
		this.item_favor   = new Item.Favor();
		this.preset_texts = new List<string>();

		this.is_texts_editable = true;
		this.initialize_item();
		this.is_texts_editable = false;

		switch(this.controll.type) {

			case "candy00":
			{
				this.item_favor.category = Item.CATEGORY.CANDY;
			}
			break;

			case "key00":
			case "key01":
			case "key02":
			case "key03":
			{
				this.item_favor.category = Item.CATEGORY.KEY;
				break;
			}

			case "key04":
			{
				this.item_favor.category = Item.CATEGORY.FLOOR_KEY;
				break;
			}

			case "ice00":
			{
				this.item_favor.category = Item.CATEGORY.SODA_ICE;
				this.item_favor.option0 = (object)false;
			}
			break;

			case "cake00":
			{
				this.item_favor.category = Item.CATEGORY.FOOD;
			}
			break;

			case "shot_negi":
			case "shot_yuzu":
			{
				this.item_favor.category = Item.CATEGORY.WEAPON;
			}
			break;


			case "dagger00":
			{
				this.item_favor.category = Item.CATEGORY.WEAPON;
			}
			break;
			case "arrow00":
			{
				this.item_favor.category = Item.CATEGORY.WEAPON;
			}
			break;
			case "bomb00":
			{
				this.item_favor.category = Item.CATEGORY.ETC;
			}
			break;
		}
	}
Ejemplo n.º 16
0
 // 아이템을 사용했을 때 호출된다.
 public virtual void             onUseItem(int slot, Item.Favor favor)
 {
 }
Ejemplo n.º 17
0
	public void OnReceiveUseItemPacket(int node, PacketId id, byte[] data)
	{
		ItemUsePacket packet = new ItemUsePacket(data);
		ItemUseData useData = packet.GetPacket();

		Debug.Log ("Receive UseItemPacket:" + useData.userId + " -> " + 
		           								useData.targetId + " (" + useData.itemCategory + ")");

		chrController	user = CharacterRoot.getInstance().findPlayer(useData.userId);

		AccountData	account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id);

		if (user != null && account_data.avator_id != useData.userId) {
			Debug.Log("use item. favor:" + useData.itemFavor);

			Item.Favor	favor = new Item.Favor();
			favor.category = (Item.CATEGORY) useData.itemCategory;
			this.useItem(-1, favor, useData.userId, useData.targetId, false);
		}
		else {
			Debug.Log("Receive packet is already done.");
		}
	}
Ejemplo n.º 18
0
	// 초기화.
	public void	initialize()
	{
		this.item_id = "";
		this.favor = null;
		this.is_using = false;
	}