Beispiel #1
0
    static int CreateCharacterBaseInfo(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, typeof(Logic.Player.Model.PlayerInfo)))
            {
                Logic.Player.Model.PlayerInfo           arg0 = (Logic.Player.Model.PlayerInfo)ToLua.ToObject(L, 1);
                Logic.Character.Model.CharacterBaseInfo o    = Logic.Character.Model.CharacterBaseInfo.CreateCharacterBaseInfo(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, typeof(Logic.Hero.Model.HeroInfo)))
            {
                Logic.Hero.Model.HeroInfo arg0            = (Logic.Hero.Model.HeroInfo)ToLua.ToObject(L, 1);
                Logic.Character.Model.CharacterBaseInfo o = Logic.Character.Model.CharacterBaseInfo.CreateCharacterBaseInfo(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Logic.Character.Model.CharacterBaseInfo.CreateCharacterBaseInfo"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #2
0
        public List <HeroInfo> GetHeroInfosStarMoreThan(int star)
        {
//			List<HeroInfo> heroInfoList = GetAllHeroInfoList();
//			List<HeroInfo> result = new List<HeroInfo>();
//			int heroInfoCount = heroInfoList.Count;
//			for (int i = 0; i < heroInfoCount; i++)
//			{
//				if (heroInfoList[i].advanceLevel >= star)
//				{
//					result.Add(heroInfoList[i]);
//				}
//			}
//			return result;

            /* from lua method */
            List <HeroInfo> heroInfoList      = new List <HeroInfo>();
            LuaTable        heroInfosLuaTable = (LuaTable)HeroModelLuaTable.GetLuaFunction("GetHeroInfosStarMoreThan").Call(3)[0];

            if (heroInfosLuaTable != null)
            {
                foreach (DictionaryEntry kvp in heroInfosLuaTable.ToDictTable())
                {
                    LuaTable heroInfoLuaTable = (LuaTable)kvp.Value;
                    HeroInfo heroInfo         = new HeroInfo(heroInfoLuaTable);
                    heroInfoList.Add(heroInfo);
                }
            }
            return(heroInfoList);
            /* from lua method */
        }
 static int GetEnemyHeroInfo(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Logic.Character.Controller.EnemyController obj = (Logic.Character.Controller.EnemyController)ToLua.CheckObject(L, 1, typeof(Logic.Character.Controller.EnemyController));
         uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2);
         Logic.Hero.Model.HeroInfo o = obj.GetEnemyHeroInfo(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #4
0
        public HeroInfo GetHeroInfo(uint heroInstanceID)
        {
//            HeroInfo heroInfo = null;
//            _heroInfoDictionary.TryGetValue(heroInstanceID, out heroInfo);
//            return heroInfo;

            /* from lua method */
            HeroInfo heroInfo         = null;
            LuaTable heroInfoLuaTable = (LuaTable)HeroModelLuaTable.GetLuaFunction("GetHeroInfo").Call(heroInstanceID)[0];

            if (heroInfoLuaTable != null)
            {
                heroInfo = new HeroInfo(heroInfoLuaTable);
            }
            return(heroInfo);
            /* from lua method */
        }
Beispiel #5
0
        public List <RoleInfo> GetUsableBreakthroughMaterialHeroList(HeroInfo breakthroughHeroInfo)
        {
            List <RoleInfo> usableBreakthroughMaterialHeroList = new List <RoleInfo>();
            List <HeroInfo> allInBagHeroInfoList  = GetNotInAnyTeamHeroInfoList();
            int             allInBagHeroInfoCount = allInBagHeroInfoList.Count;

            for (int i = 0; i < allInBagHeroInfoCount; i++)
            {
                HeroInfo heroInfo = allInBagHeroInfoList[i];
                if (heroInfo.instanceID != breakthroughHeroInfo.instanceID &&
                    heroInfo.heroData.id == breakthroughHeroInfo.heroData.id &&
                    heroInfo.advanceLevel >= GetBreakthroughMaterialStarRequirements(breakthroughHeroInfo))
                {
                    usableBreakthroughMaterialHeroList.Add(heroInfo);
                }
            }
            return(usableBreakthroughMaterialHeroList);
        }
Beispiel #6
0
        public List <HeroInfo> GetAllHeroInfoList()
        {
//            return new List<HeroInfo>(_heroInfoDictionary.Values);

            /* from lua method */
            List <HeroInfo> allHeroInfoList = new List <HeroInfo>();
            LuaFunction     getAllHeroInfoListLuaFunction = HeroModelLuaTable.GetLuaFunction("GetAllHeroInfoList");
            LuaTable        allHeroInfoLuaTable           = (LuaTable)getAllHeroInfoListLuaFunction.Call(null)[0];

            if (allHeroInfoLuaTable != null)
            {
                foreach (DictionaryEntry kvp in allHeroInfoLuaTable.ToDictTable())
                {
                    //int heroInstanceID = kvp.Key.ToString().ToInt32();
                    LuaTable heroInfoLuaTable = (LuaTable)kvp.Value;
                    HeroInfo heroInfo         = new HeroInfo(heroInfoLuaTable);
                    allHeroInfoList.Add(heroInfo);
                }
            }
            return(allHeroInfoList);
            /* from lua method */
        }
Beispiel #7
0
        public HeroInfo GetHeroInfoCopy()
        {
            HeroInfo heroInfoCopy = new HeroInfo(this.instanceID, this.heroData.id, this.breakthroughLevel, this.strengthenLevel, this.advanceLevel, this.level);

            return(heroInfoCopy);
        }