Beispiel #1
0
 public void OnGlobalUIEventHandler(int eventType, object data)
 {
     switch (eventType)
     {
     case (int)Client.GameEventID.UIEVENT_REFRESHCURRENCYNUM:
         ItemDefine.UpdateCurrecyPassData updateData = (ItemDefine.UpdateCurrecyPassData)data;
         if (updateData.MoneyType == GameCmd.MoneyType.MoneyType_Coin)
         {
             for (int i = 0; i < m_lstRewardCard.Count; i++)
             {
                 m_lstRewardCard[i].UpdateItemNum();
             }
         }
         break;
     }
 }
Beispiel #2
0
    public void Execute(stRefreshMoneyPropertyUserCmd_S cmd)
    {
        IPlayer player = ClientGlobal.Instance().MainPlayer;

        GameCmd.MoneyType e = (GameCmd.MoneyType)cmd.type;
        //为第一次加载 || InitType 服务器通知是否是游戏运行中刷新货币
        bool firstLoad = (null == player) || cmd.inittype == 1;

        ItemDefine.UpdateCurrecyPassData passData = null;
        int changeNum = 0;

        switch (e)
        {
        case GameCmd.MoneyType.MoneyType_MoneyTicket:     // (文钱)
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.Money, (int)cmd.dwNum);
            }
            changeNum      = (int)cmd.dwNum - UserData.Money;
            UserData.Money = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_Gold:     // (金币)
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.Coupon, (int)cmd.dwNum);
            }
            changeNum       = (int)cmd.dwNum - (int)UserData.Coupon;
            UserData.Coupon = (int)cmd.dwNum;

            break;
        }

        case GameCmd.MoneyType.MoneyType_Coin:     // (元宝)
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.Cold, (int)cmd.dwNum);
            }
            changeNum     = (int)cmd.dwNum - (int)UserData.Cold;
            UserData.Cold = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_Score:     //积分
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.Score, (int)cmd.dwNum);
            }
            changeNum      = (int)cmd.dwNum - (int)UserData.Score;
            UserData.Score = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_Reputation:     //声望
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.Reputation, (int)cmd.dwNum);
            }
            changeNum           = (int)cmd.dwNum - (int)UserData.Reputation;
            UserData.Reputation = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_AchievePoint:     //声望
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.AchievePoint, (int)cmd.dwNum);
            }
            changeNum             = (int)cmd.dwNum - (int)UserData.AchievePoint;
            UserData.AchievePoint = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_CampCoin:     //阵营积分
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.CampCoin, (int)cmd.dwNum);
            }
            changeNum         = (int)cmd.dwNum - (int)UserData.CampCoin;
            UserData.CampCoin = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_HuntingCoin:     //狩猎积分
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.ShouLieScore, (int)cmd.dwNum);
            }
            changeNum             = (int)cmd.dwNum - (int)UserData.ShouLieScore;
            UserData.ShouLieScore = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_FishingMoney:     //鱼币
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.FishingMoney, (int)cmd.dwNum);
            }
            changeNum             = (int)cmd.dwNum - (int)UserData.FishingMoney;
            UserData.FishingMoney = (int)cmd.dwNum;
            break;
        }

        case GameCmd.MoneyType.MoneyType_TradeGold:     //银两
        {
            if (player != null)
            {
                player.SetProp((int)PlayerProp.YinLiang, (int)cmd.dwNum);
            }
            changeNum         = (int)cmd.dwNum - (int)UserData.YinLiang;
            UserData.YinLiang = (int)cmd.dwNum;
            break;
        }

        default:
        {
            break;
        }
        }

        if (!firstLoad)
        {
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENT_REFRESHCURRENCYNUM, new ItemDefine.UpdateCurrecyPassData()
            {
                MoneyType = e,
                ChangeNum = changeNum,
            });
        }
    }