示例#1
0
    private void HandleEvent(Item item, Player player)
    {
        if (m_debug)
        {
            Debug.Log(string.Format("GameManager12:HandleEvent() \n" +
                                    "=> ItemType:{0} EffectType:{1} goldValue:{2}\n" +
                                    "=> Player:{3} - {4}", item.ItemType, item.EffectType, item.goldValue, player.NumPlayer, player.Name));
        }

        string faction = GetFactionStringFromFaction(player.Faction);

        int    platformCode;
        string playerName;

        SplitPlayerID(player.Name, out platformCode, out playerName);

        string state = "";

        switch (item.ItemType)
        {
        case Item.e_itemType.COINCHEST:
            float goldChest = item.goldValue;
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous avez découvert un coffre de pièces!");
            break;

        case Item.e_itemType.GRENADES:
            m_InventoryDisplay.AjoutInventaire(faction, player.Faction.ListPlayer.IndexOf(player) + 1, "GRENADE");
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous avez rammassé une grenade!");
            break;

        case Item.e_itemType.SHOVEL:
            m_InventoryDisplay.AjoutInventaire(faction, player.Faction.ListPlayer.IndexOf(player) + 1, "PELLE");
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous avez trouvé une pelle!");
            break;

        case Item.e_itemType.PARCHEMENT:
            state = "STUN";
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous vous êtes fait une entorse.");
            break;

        case Item.e_itemType.STRAIN:
            state = "STRAIN";
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous vous êtes fait une entorse.");
            break;

        case Item.e_itemType.GLASSES:
            SendMessageToPlayer((Platform)platformCode, playerName, "Vous avez les lunettes!");
            break;

        default:
            break;
        }

        SendCommand(state, player.Name);
    }