Exemplo n.º 1
0
        /** 反馈--战斗结束 */
        void S_BattleEnd_0x830(S_BattleEnd_0x830 msg)
        {
            War.endProto = msg;
            WarOverData overData = new WarOverData();

            foreach (ProtoRoleFightResult info in msg.fight_result)
            {
                LegionData legionData = War.GetLegionDataByRoleId(info.roleId);

                WarOverLegionData result = new WarOverLegionData();
                result.roleId     = info.roleId;
                result.legionId   = legionData.legionId;
                result.starCount  = info.star;
                result.buildCount = info.build_count;
                result.buildTotal = info.build_total;
                result.overType   = (OverType)info.end_type;

                if (result.legionId == War.ownLegionID)
                {
                    overData.overType = result.overType;
                }

                overData.legionDatas.Add(result);
            }

            War.S_Over(overData);
        }
Exemplo n.º 2
0
        public List <WarOverLegionData> GetOverData()
        {
            List <WarOverLegionData> list = new List <WarOverLegionData>();

            int buildTotal = War.scene.GetBuilds().Count;

            foreach (var kvp in legionDict)
            {
                LegionData        legionData = kvp.Value.legionData;
                int               legionId   = legionData.legionId;
                WarOverLegionData result     = new WarOverLegionData();
                result.legionId   = legionData.legionId;
                result.roleId     = legionData.roleId;
                result.starCount  = kvp.Value.GetSuccessStars().Length;
                result.buildCount = War.scene.GetBuilds(legionId).Count;
                result.buildTotal = buildTotal;
                Debug.LogFormat("GetOverData legionId={0}, result.roleId={1}, type={2}, starCount={3},  buildCount={4}", legionId, result.roleId, legionData.type, result.starCount, result.buildCount);


                if (War.GetRelationType(kvp.Value.legionData.legionId) != RelationType.Enemy)
                {
                    result.overType = War.overType;
                }
                else
                {
                    OverType overType = OverType.Draw;
                    switch (War.overType)
                    {
                    case OverType.Draw:
                        overType = OverType.Draw;
                        break;

                    case OverType.Lose:
                        overType = OverType.Win;
                        break;

                    case OverType.Win:
                        overType = OverType.Lose;
                        break;
                    }


                    result.overType = overType;
                }

                list.Add(result);


                //TODO Test
                //result.starCount = 3;
            }

            return(list);
        }
    static int _CreateGames_Module_Wars_WarOverLegionData(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            Games.Module.Wars.WarOverLegionData obj = new Games.Module.Wars.WarOverLegionData();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Games.Module.Wars.WarOverLegionData.New");
        }

        return(0);
    }
    static int get_legionId(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.WarOverLegionData obj = (Games.Module.Wars.WarOverLegionData)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name legionId");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index legionId on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.legionId);
        return(1);
    }
    static int set_overType(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.WarOverLegionData obj = (Games.Module.Wars.WarOverLegionData)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name overType");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index overType on a nil value");
            }
        }

        obj.overType = (Games.Module.Wars.OverType)LuaScriptMgr.GetNetObject(L, 3, typeof(Games.Module.Wars.OverType));
        return(0);
    }
    static int set_buildTotal(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        Games.Module.Wars.WarOverLegionData obj = (Games.Module.Wars.WarOverLegionData)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name buildTotal");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index buildTotal on a nil value");
            }
        }

        obj.buildTotal = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }