示例#1
0
    public void OnGameFinsih(params object[] objs)
    {
        WorldBase world = (WorldBase)objs[0];

        world.eventSystem.DispatchEvent(GameUtils.c_scoreChange, null);
        List <PlayerComponent> rankList = world.GetSingletonComp <RankComponent>().rankList;
        int diamond = rankList.Count;

        for (int i = 0; i < rankList.Count; i++)
        {
            ConnectionComponent cc = rankList[i].Entity.GetComp <ConnectionComponent>();

            PlayerSettlement_c msg = new PlayerSettlement_c();
            msg.rank              = i + 1;
            msg.diamond           = diamond--;
            msg.score             = rankList[i].score;
            msg.historicalHighest = rankList[i].score;

            if (cc.m_session != null)
            {
                cc.m_session.player.Diamond += msg.diamond;
                ProtocolAnalysisService.SendMsg(cc.m_session, msg);
            }
            else
            {
                //TODO 将奖励发放给离线玩家
            }
        }
    }
    public void OnGameFinsih(params object[] objs)
    {
        WorldBase world = (WorldBase)objs[0];

        world.eventSystem.DispatchEvent(GameUtils.c_scoreChange, null);
        List <PlayerComponent> rankList = world.GetSingletonComp <RankComponent>().rankList;
        int diamond = rankList.Count;

        for (int i = 0; i < rankList.Count; i++)
        {
            string playerID = rankList[i].Entity.GetComp <ConnectionComponent>().m_playerID;

            if (playerID != null && m_disConnectDict.ContainsKey(playerID))
            {
                m_disConnectDict.Remove(playerID);
            }
        }
    }