public void InitData(Hero hero, HeroIconType heroicontype = HeroIconType.HeroScene) { //Reset(); heroIconType = heroicontype; mHero = hero; HeroTableData data = DataManager.GetInstance().GetHeroTableDataByHeroId(0); if (data != null) { AddIcon(data.icon); } icon.gameObject.SetActive(true); noteam.gameObject.SetActive(false); Text text = qualityTxtArr[(int)hero.heroQuality]; text.gameObject.SetActive(true); GetComponent <Image>().color = text.color; //GameObject obj = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("", "Sword 01 Black"); //if (obj != null && Camera.main != null) //{ // obj.transform.SetParent(Camera.main.transform.parent,false); // //if (ItemShow != null && heroSceneCamera != null) // { // Vector3 pos = transform.position; // obj.transform.position = Camera.main.ScreenToWorldPoint(pos); // } //} }
public void SetHeroData(HeroTableData heroData) { GetControls(); HeroLevel.gameObject.SetActive(false); SliderChips.gameObject.SetActive(true); ImageHeroHead.sprite = Assets.Script.SpriteFactory.me.Get("HeroHead", heroData.Id); ImageHeroQuality.sprite = Assets.Script.SpriteFactory.me.Get("HeroQuality", 1); ImageHeroOccupation.sprite = Assets.Script.SpriteFactory.me.Get("HeroOccupation", heroData.HeroOccupation); TextHeroName.text = heroData.HeroName; }
public HeroTableData NewHeroByHeroTableData(HeroTableData heroTableData) { Hero hero = new Hero { //heroId = heroTableData.id, teamPosition = -1, heroLevel = 1 }; return(null); }
private void InitHeroTableData() { string[][] arrAll = GetData(TableDataName.HeroTableData.ToString()); for (int i = 0; i < arrAll.Length; i++) { string[] arr = arrAll[i]; int id = int.Parse(arr[0]); HeroTableData tableData = new HeroTableData { id = id, name = arr[1], des = arr[2], icon = arr[3], heroPrefab = arr[4], hp = int.Parse(arr[5]), attack = int.Parse(arr[6]), defene = int.Parse(arr[7]), magic = int.Parse(arr[8]), magicDef = int.Parse(arr[9]), speed = int.Parse(arr[10]), technique = int.Parse(arr[11]), isCanMove = int.Parse(arr[12]), equipType = int.Parse(arr[13]), searchRadius = float.Parse(arr[14]), attackSpeed = float.Parse(arr[15]), moveSpeed = float.Parse(arr[16]), skillid = int.Parse(arr[17]), heroJob = int.Parse(arr[18]), //职业 heroQuality = int.Parse(arr[19]), //资质 heroSex = int.Parse(arr[20]), //性别 heroHair = int.Parse(arr[21]), //头发 heroBeard = int.Parse(arr[22]), //胡子 heroBody = int.Parse(arr[23]) //形象 }; HeroTableDataDic[id] = tableData; } ///////////////////////// arrAll = GetData(TableDataName.DefaultItemTableData.ToString()); for (int i = 0; i < arrAll.Length; i++) { string[] arr = arrAll[i]; int id = int.Parse(arr[0]); DefaultItemTableData tableData = new DefaultItemTableData { id = id, itemid = int.Parse(arr[1]), type = int.Parse(arr[2]), masterId = int.Parse(arr[3]) }; DefaultItemTableDataDic[id] = tableData; } }
public void SetHeroInfo(HeroInfo heroInfo) { GetControls(); int heroResData = heroInfo.Id & 0xffff; HeroTableData heroTableData = Database.me.GetById <HeroTableData>(heroResData); ImageHeroHead.sprite = Assets.Script.SpriteFactory.me.Get("HeroHead", heroResData); ImageHeroQuality.sprite = Assets.Script.SpriteFactory.me.Get("HeroQuality", heroInfo.Quality); ImageHeroOccupation.sprite = Assets.Script.SpriteFactory.me.Get("HeroOccupation", heroTableData.HeroOccupation); TextHeroName.text = heroTableData.HeroName; TextHeroLevel.text = "Lv." + heroInfo.Level.ToString(); HeroLevel.gameObject.SetActive(true); SliderChips.gameObject.SetActive(false); }
static int SetHeroData(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); HeroItem obj = (HeroItem)ToLua.CheckObject(L, 1, typeof(HeroItem)); HeroTableData arg0 = (HeroTableData)ToLua.CheckObject(L, 2, typeof(HeroTableData)); obj.SetHeroData(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_Id(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); HeroTableData obj = (HeroTableData)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.Id = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Id on a nil value" : e.Message)); } }
static int get_HeroOccupation(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); HeroTableData obj = (HeroTableData)o; int ret = obj.HeroOccupation; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index HeroOccupation on a nil value" : e.Message)); } }
static int set_HeroName(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); HeroTableData obj = (HeroTableData)o; string arg0 = ToLua.CheckString(L, 2); obj.HeroName = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index HeroName on a nil value" : e.Message)); } }
public void InitMonster(string[] monsterArr) { if (WayGameObject != null) { for (int i = 0; i < monsterArr.Length; i++) { int monsterid = int.Parse(monsterArr[i]); HeroTableData heroTableData = DataManager.GetInstance().GetHeroTableDataByHeroId(monsterid); if (heroTableData != null) { GameObject enity = EnityManager.GetInstance().CreateEnity(EnityType.Enemy, heroTableData.heroPrefab); enity.transform.SetParent(WayGameObject.transform.parent.transform, false); enity.transform.position = monsterPosArr[i].position; } } } }
static int _CreateHeroTableData(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { HeroTableData obj = new HeroTableData(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: HeroTableData.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public DataManager() { //CreateItemTableData(); //CreateDIYTableData("Assets/Little Heroes Mega Pack/Prefabs/01 Choose Costume", ".prefab"); assetBundlePrefabs = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/prefab"); assetBundleStatic = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/staticdata"); assetBundleUI = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/ui"); assetBundleMaterial = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/material"); InitItemTableDataOld(); InitItemTableData(); InitHeroTableData(); InitEnemyTableData(); InitAnimationTableData(); InitChapterTableData(); InitDIYTableData(); InitConfigTableData(); //初始化英雄,可以读取本地数据,或者服务器发来的数据 LoadByBin(); if (GD == null)//说明第一次启动,需要读取初始的英雄信息,最好配置表 { GD = new GameData(); int teamposition = 0; long startid = long.Parse(System.DateTime.Now.ToString("yyyyMMddhhmmss")); foreach (KeyValuePair <int, DefaultItemTableData> pair in DefaultItemTableDataDic) { //if (HeroTableDataDic.ContainsKey(pair.Value.itemid)) { if (pair.Value.type == 2)//如果是装备 { ItemTableData itemTableData = ItemTableDataDic[pair.Value.itemid]; Item item = new Item { id = startid + pair.Key, itemId = pair.Value.itemid, masterId = pair.Value.masterId, itemLevel = 1 }; GD.Items.Add(item.id, item); } else if (pair.Value.type == 1) { HeroTableData heroTableData = HeroTableDataDic[pair.Value.itemid]; Hero hero = new Hero { id = RandomHeroManager.instance.GetRandomId(), teamPosition = 0, heroLevel = 1, heroJob = (HeroJob)heroTableData.heroJob, heroQuality = (HeroQuality)heroTableData.heroQuality, heroSex = (HeroSex)heroTableData.heroSex }; hero.heroPartDic[HeroPart.Body] = heroTableData.heroBody; hero.heroPartDic[HeroPart.Hair] = heroTableData.heroHair; hero.heroPartDic[HeroPart.Beard] = heroTableData.heroBeard; teamposition++; GD.Heroes.Add(hero.id, hero); } } } SaveByBin();//保存下 } CreateItem(); foreach (KeyValuePair <long, Item> item in GD.Items) { if (item.Value.masterId > 0) //有持有者 { if (GD.Heroes.ContainsKey(item.Value.masterId)) //如果有这个持有者 { Hero hero = GD.Heroes[item.Value.masterId]; ItemTableData itemTableData = GetItemTableDataByItemId(item.Value.itemId); if (itemTableData != null) { hero.dummyPropDic[(DummyProp)itemTableData.group] = item.Value.id; } } } } }