예제 #1
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(l);
            if (num == 1)
            {
                HeroJob o = new HeroJob();
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (num == 2)
            {
                HeroJob other;
                LuaObject.checkType <HeroJob>(l, 2, out other);
                HeroJob o = new HeroJob(other);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else
            {
                result = LuaObject.error(l, "New object failed.");
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #2
0
 public HeroData(string uid, HeroDataRow dataRow, HeroJob heroJob, double exp, int level, List <string> skills)
     : base(uid, dataRow.ID, dataRow.Name, skills, heroJob.InitHp, heroJob.InitMp, heroJob.InitAtk,
            heroJob.InitDef, level, heroJob.HPGrowthRate, heroJob.MPGrowthRate, heroJob.AtkGrowthRate, heroJob.DefGrowthRate)
 {
     Job           = dataRow.Job;
     HeadImageKey  = HEAD_IMAGE_KEY_PREFIX + heroJob.HeadImageKey;
     DeathImageKey = DEATH_IMAGE_KEY_PREFIX + heroJob.DeathImageKey;
     Exp           = exp;
 }
예제 #3
0
    public List <DIYTableData> GetDIYTableDatasByHeroJobAndSex(HeroJob heroJob, HeroSex sex)
    {
        List <DIYTableData> dIYTableDatas = new List <DIYTableData>();

        foreach (KeyValuePair <int, DIYTableData> item in DIYTableDataDic)
        {
            if (item.Value.job == (int)heroJob && item.Value.sex == (int)sex)
            {
                dIYTableDatas.Add(item.Value);
            }
        }
        return(dIYTableDatas);
    }
예제 #4
0
    public Hero OnRandomOneHero()
    {
        HeroJob     heroJob     = (HeroJob)Random.Range((int)HeroJob.Archer, (int)HeroJob.NULL);
        HeroSex     sex         = Random.Range(0, 100) > 50 ? HeroSex.Female : HeroSex.Male;
        HeroQuality heroQuality = (HeroQuality)Random.Range((int)HeroQuality.B, (int)HeroQuality.NULL);
        Hero        hero        = new Hero
        {
            id          = GetRandomId(),
            heroLevel   = 1,
            heroJob     = heroJob,
            heroQuality = heroQuality,
            heroSex     = sex
        };
        ///////获取身体/////////////////////////////////////////////
        List <DIYTableData> dIYTableDatas = DataManager.GetInstance().GetDIYTableDatasByHeroJobAndSex(heroJob, sex);

        if (dIYTableDatas.Count > 0)
        {
            int          bodyIndex = Random.Range(0, dIYTableDatas.Count);
            DIYTableData body      = dIYTableDatas[bodyIndex];
            hero.heroPartDic[HeroPart.Body] = body.id;
        }
        List <DIYTableData> dIYTableDataHairs = DataManager.GetInstance().GetDIYTableDatasByHeroPartAndSex(HeroPart.Hair, sex);

        if (dIYTableDataHairs.Count > 0)
        {
            int          hairIndex = Random.Range(0, dIYTableDataHairs.Count);
            DIYTableData hairdata  = dIYTableDataHairs[hairIndex];
            hero.heroPartDic[HeroPart.Hair] = hairdata.id;
        }
        int min_age        = DataManager.instance.GetConfigValueToInt("min_age");
        int max_age        = DataManager.instance.GetConfigValueToInt("max_age");
        int have_beard_age = DataManager.instance.GetConfigValueToInt("have_beard_age");
        int age            = Random.Range(min_age, max_age); //随机年龄

        if (age < have_beard_age && sex == HeroSex.Male)     //xx岁以下不添加胡子
        {
            List <DIYTableData> dIYTableDataBeards = DataManager.GetInstance().GetDIYTableDatasByHeroPartAndSex(HeroPart.Beard, sex);
            if (dIYTableDataBeards.Count > 0)
            {
                int          beardIndex = Random.Range(0, dIYTableDataBeards.Count);
                DIYTableData bearddata  = dIYTableDataBeards[beardIndex];
                hero.heroPartDic[HeroPart.Beard] = bearddata.id;
            }
        }
        return(hero);
    }
예제 #5
0
    public static int get_JobConnectionInfo(IntPtr l)
    {
        int result;

        try
        {
            HeroJob heroJob = (HeroJob)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, heroJob.JobConnectionInfo);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #6
0
    public static int GetModelSkinResourceInfo(IntPtr l)
    {
        int result;

        try
        {
            HeroJob heroJob = (HeroJob)LuaObject.checkSelf(l);
            ConfigDataModelSkinResourceInfo modelSkinResourceInfo = heroJob.GetModelSkinResourceInfo();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, modelSkinResourceInfo);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #7
0
    public static int set_ModelSkinId(IntPtr l)
    {
        int result;

        try
        {
            HeroJob heroJob = (HeroJob)LuaObject.checkSelf(l);
            int     modelSkinId;
            LuaObject.checkType(l, 2, out modelSkinId);
            heroJob.ModelSkinId = modelSkinId;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #8
0
    public static int set_JobLevel(IntPtr l)
    {
        int result;

        try
        {
            HeroJob heroJob = (HeroJob)LuaObject.checkSelf(l);
            int     jobLevel;
            LuaObject.checkType(l, 2, out jobLevel);
            heroJob.JobLevel = jobLevel;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #9
0
    public static int set_Achievements(IntPtr l)
    {
        int result;

        try
        {
            HeroJob       heroJob = (HeroJob)LuaObject.checkSelf(l);
            HashSet <int> achievements;
            LuaObject.checkType <HashSet <int> >(l, 2, out achievements);
            heroJob.Achievements = achievements;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #10
0
    public static int PbHeroJobToHeroJob_s(IntPtr l)
    {
        int result;

        try
        {
            ProHeroJob pbHeroJob;
            LuaObject.checkType <ProHeroJob>(l, 1, out pbHeroJob);
            HeroJob o = HeroJob.PbHeroJobToHeroJob(pbHeroJob);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #11
0
    public static int HeroJobToPBHeroJob_s(IntPtr l)
    {
        int result;

        try
        {
            HeroJob heroJob;
            LuaObject.checkType <HeroJob>(l, 1, out heroJob);
            ProHeroJob o = HeroJob.HeroJobToPBHeroJob(heroJob);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int BattleHeroJobToHeroJob_s(IntPtr l)
    {
        int result;

        try
        {
            BattleHeroJob battleHeroJob;
            LuaObject.checkType <BattleHeroJob>(l, 1, out battleHeroJob);
            HeroJob o = BattleHeroJob.BattleHeroJobToHeroJob(battleHeroJob);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #13
0
        // Token: 0x06010B3F RID: 68415 RVA: 0x00455D5C File Offset: 0x00453F5C
        public bool IsJobMaster()
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_IsJobMaster_hotfix != null)
            {
                return(Convert.ToBoolean(this.m_IsJobMaster_hotfix.call(new object[]
                {
                    this
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            HeroJob job = this.m_hero.GetJob(this.JobConnectionInfo.ID);

            if (job == null)
            {
                return(false);
            }
            int jobLevel = job.JobLevel;
            int num      = this.JobConnectionInfo.m_jobLevelInfos.Length - 1;

            return(jobLevel == num);
        }
예제 #14
0
    public static int IsLevelMax(IntPtr l)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(l);
            if (num == 1)
            {
                HeroJob heroJob = (HeroJob)LuaObject.checkSelf(l);
                bool    b       = heroJob.IsLevelMax();
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, b);
                result = 2;
            }
            else if (num == 2)
            {
                HeroJob heroJob2 = (HeroJob)LuaObject.checkSelf(l);
                int     jobLevel;
                LuaObject.checkType(l, 2, out jobLevel);
                bool b2 = heroJob2.IsLevelMax(jobLevel);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, b2);
                result = 2;
            }
            else
            {
                LuaObject.pushValue(l, false);
                LuaDLL.lua_pushstring(l, "No matched override function IsLevelMax to call");
                result = 2;
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #15
0
        // Token: 0x06010D9F RID: 69023 RVA: 0x0045D860 File Offset: 0x0045BA60
        public void InitConditionItem(ConfigDataJobUnlockConditionInfo condition, HeroJob heroJob)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_InitConditionItemConfigDataJobUnlockConditionInfoHeroJob_hotfix != null)
            {
                this.m_InitConditionItemConfigDataJobUnlockConditionInfoHeroJob_hotfix.call(new object[]
                {
                    this,
                    condition,
                    heroJob
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            this.ConditionInfo             = condition;
            this.m_text.text = condition.Desc;
            bool active = true;
            ProjectLPlayerContext projectLPlayerContext = GameManager.Instance.PlayerContext as ProjectLPlayerContext;

            if (condition.ID != 0)
            {
                active = (heroJob != null && heroJob.Achievements.Contains(condition.ID));
            }
            else if (condition.ItemCost.Count != 0)
            {
                foreach (Goods goods in condition.ItemCost)
                {
                    int bagItemCountByType = projectLPlayerContext.GetBagItemCountByType(GoodsType.GoodsType_Item, goods.Id);
                    if (bagItemCountByType < goods.Count)
                    {
                        active = false;
                        break;
                    }
                }
            }
            this.m_finishTag.SetActive(active);
        }
예제 #16
0
    public Dictionary <HeroJob, List <string> > GetFileNameByPathForDIY(string path, string format)
    {
        Dictionary <HeroJob, List <string> > names = new Dictionary <HeroJob, List <string> >();
        //1、获得当前运行程序的路径
        string rootPath = Directory.GetCurrentDirectory();
        //C#遍历指定文件夹中的所有文件
        DirectoryInfo TheFolder = new DirectoryInfo(path);

        if (!TheFolder.Exists)
        {
            return(null);
        }


        DirectoryInfo[] directoryInfos = TheFolder.GetDirectories();
        for (int i = 0; i < directoryInfos.Length; i++)
        {
            //FileInfo[] fileInfosAll = directoryInfos[i].GetFiles(directoryInfos[i].FullName, SearchOption.AllDirectories);
            DirectoryInfo[] directoryInfos2 = directoryInfos[i].GetDirectories();
            for (int k = 0; k < directoryInfos2.Length; k++)
            {
                FileInfo[] fileInfos = directoryInfos2[k].GetFiles();
                //遍历文件
                foreach (FileInfo NextFile in fileInfos)
                {
                    //if (NextFile.Name == "0-0-11.grid")
                    //    continue;
                    // 获取文件完整路径
                    //string heatmappath = NextFile.FullName;
                    HeroJob keyname = HeroJob.NULL;
                    if (NextFile.Directory.Name.Contains("Archer"))
                    {
                        keyname = HeroJob.Archer;
                    }
                    if (NextFile.Directory.Name.Contains("Knight"))
                    {
                        keyname = HeroJob.Warrior;
                    }
                    if (NextFile.Directory.Name.Contains("Long Dress") || NextFile.Directory.Name.Contains("Long Robe"))
                    {
                        keyname = HeroJob.Priest;
                    }
                    if (NextFile.Directory.Name.Contains("Sorceress") || NextFile.Directory.Name.Contains("Wizard"))
                    {
                        keyname = HeroJob.Mage;
                    }
                    if (NextFile.Directory.Name.Contains("Special"))
                    {
                        keyname = HeroJob.Assassin;
                    }
                    if (keyname != HeroJob.NULL)
                    {
                        if (!names.ContainsKey(keyname))
                        {
                            names[keyname] = new List <string>();
                        }
                        if (format == NextFile.Extension)
                        {
                            string name = NextFile.Name.Replace(format, "");
                            names[keyname].Add(name.Trim());
                        }
                    }
                }
            }
        }

        return(names);
    }