private void PshPower(object sender, GameEventArgs e)
    {
        OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs;

        if (ne.msgID != CMD.PshPower)
        {
            return;
        }

        PshPower data = ne.scPacketBase as PshPower;

        PECommon.SetPlayerDataByPower(data);
        UGuiForm mainCityForm = GameEntry.UI.GetUIForm(UIFormId.MainCityForm);

        if (!mainCityForm)
        {
            return;
        }
        if (mainCityForm.Visible)
        {
            OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>();
            eventArgs.Fill(UIFormId.MainCityForm);
            GameEntry.Event.FireNow(this, eventArgs);
        }
    }
Ejemplo n.º 2
0
    public void PshPower(GameMsg msg)
    {
        PshPower pshPower = msg.pshPower;

        GameRoot.instance.SetPlayerDataByPower(pshPower);
        maincityWind.RefreshUI();
    }
Ejemplo n.º 3
0
    public void PshPower(GameMsg msg)
    {
        PshPower data = msg.pshPower;

        GameRoot.Instance.SetPlayerDataByPower(data);
        if (mainCityWnd.GetWndSatate())
        {
            mainCityWnd.RefreshUI();
        }
    }
Ejemplo n.º 4
0
    public void PshPower(GameMsg msg)
    {
        PshPower data = msg.val as PshPower;

        GameRoot.Instance.SetPlayerDataByPower(data);
        if (mainCityWnd.gameObject.activeSelf)
        {
            mainCityWnd.RefreshUI();
        }
    }
Ejemplo n.º 5
0
    private void CalcPowerAdd(int tid)
    {
        //计算体力增长
        PshPower msg = new PshPower();
        //所有在线玩家获得实时的体力增长推送数据
        Dictionary <ClientSocket, PlayerData> onlineDic = cacheSvc.GetOnlineCache();

        if (onlineDic.Count > 0)
        {
            KDCommon.Log("All Online Player Calc Power Incress....");
        }

        foreach (var item in onlineDic)
        {
            PlayerData   pd      = item.Value;
            ClientSocket session = item.Key;

            int powerMax = KDCommon.GetPowerLimit(pd.Lv);
            if (pd.Power >= powerMax)
            {
                continue;
            }
            else
            {
                pd.Power += KDCommon.PowerAddCount;
                pd.Time   = timerSvc.GetNowTime();
                if (pd.Power > powerMax)
                {
                    pd.Power = powerMax;
                }
            }
            if (!cacheSvc.UpdatePlayerData(pd.Id, pd))
            {
                msg.error = (int)ErrorCode.UpdateDBError;
            }
            else
            {
                msg.Power = pd.Power;
                session.SendMsg(msg);
            }
        }
    }
Ejemplo n.º 6
0
 public void SetPlayerDataByPower(PshPower data)
 {
     PlayerData.power = data.power;
 }