private void OnLoadDataTableSuccess(object sender, GameEventArgs e) { //获取框架数据表组件 DataTableComponent DataTable = GameEntry.GetComponent <DataTableComponent>(); //获得数据表 IDataTable <DRHero> dtScene = DataTable.GetDataTable <DRHero>(); //获得所有行 DRHero[] drHeros = dtScene.GetAllDataRows(); Log.Debug("drHeros:" + drHeros.Length); //根据行号获取某一行 DRHero drScene = dtScene.GetDataRow(1); //DRHero drScene = drHeros[1]; if (drScene != null) { string name = drScene.Name; int atk = drScene.Atk; Log.Debug("name:" + name + ",atk:" + atk); } else { Log.Debug("index not exist"); } //获取满足条件的所有行 DRHero[] drScenesWithCondition = dtScene.GetAllDataRows(x => x.Id > 0); //获取满足条件的第一行 DRHero drFirstSceneWithCondition = dtScene.GetDataRow(x => x.Name == "mutou"); }
protected override void OnLoad() { dtEnemy = GameEntry.DataTable.GetDataTable <DREnemy>(); if (dtEnemy == null) { throw new System.Exception("Can not get data table Enemy"); } DataProjectile dataProjectile = GameEntry.Data.GetData <DataProjectile>(); if (dataProjectile == null) { Log.Error("Can't load DataProjectile"); return; } dicEnemyData = new Dictionary <int, EnemyData>(); DREnemy[] dREnemies = dtEnemy.GetAllDataRows(); foreach (var drEnemy in dREnemies) { ProjectileData projectileData = dataProjectile.GetProjectileData(drEnemy.ProjectileData); EnemyData enemyData = new EnemyData(drEnemy, projectileData); dicEnemyData.Add(drEnemy.Id, enemyData); } }
public T[] GetConfigs <T>() where T : IDataRow { IDataTable <T> config = _data.GetDataTable <T>(); T[] configs = config.GetAllDataRows(); return(configs); }
private void OnLoadDataTableSuccess(object sender, GameEventArgs e) { // 获取框架数据表组件 DataTableComponent DataTable = UnityGameFramework.Runtime.GameEntry.GetComponent <DataTableComponent>(); // 获得数据表 IDataTable <DRheros> dtScene = DataTable.GetDataTable <DRheros>(); // 获得所有行 DRheros[] drHeros = dtScene.GetAllDataRows(); Log.Debug("drHeros:" + drHeros.Length); // 根据行号获得某一行 DRheros drScene = dtScene.GetDataRow(1); // 或直接使用 dtScene[1] if (drScene != null) { // 此行存在,可以获取内容了 string name = drScene.Name; int atk = drScene.Atk; Log.Debug("name:" + name + ", atk:" + atk); } else { // 此行不存在 } // 获得满足条件的所有行 DRheros[] drScenesWithCondition = dtScene.GetDataRows(x => x.Id > 0); // 获得满足条件的第一行 DRheros drSceneWithCondition = dtScene.GetDataRow(x => x.Name == "mutou"); }
protected override void OnEnter(ProcedureOwner procedureOwner) { base.OnEnter(procedureOwner); m_ProcedureOwner = procedureOwner; //初始化数据 InitData(); //显示第一个职业 GameEntry.Entity.ShowPoseRole(m_WarriorData); m_SelectRoleTypeId = m_WarriorTypeId; //打开创建角色界面 RoleCreateFormData data = new RoleCreateFormData(); IDataTable <DRRoleName> nameDt = GameEntry.DataTable.GetDataTable <DRRoleName>(); DRRoleName[] allNames = nameDt.GetAllDataRows(); Queue <string> namesQueue = new Queue <string>(); for (int i = 0; i < allNames.Length; i++) { namesQueue.Enqueue(allNames[i].RoleName); } data.RandomNameQueue = namesQueue; data.OnClickRoleType = OnClickRoleType; data.OnClickCreateRole = OnClickCreateRole; GameEntry.UI.OpenUIForm(UIFormId.CreateRoleForm, data); }
/// <summary> /// 创建生物 /// </summary> public void CreateCreatures() { // 创建主角 HeroData heroData = new HeroData(EntityExtension.GenerateSerialId(), PlayerData.CurrentFightHeroID, CampType.Player); heroData.Position = new Vector3(15, 0, 15); EntityExtension.ShowHero(typeof(Hero), "PlayerGroup", heroData); // 创建魔力泉 IDataTable <DRMagicWater> dtMagicWater = GameEntry.DataTable.GetDataTable <DRMagicWater> (); DRMagicWater[] magicWaters = dtMagicWater.GetAllDataRows(); foreach (DRMagicWater magicWater in magicWaters) { MagicWaterData magicWaterData = new MagicWaterData(EntityExtension.GenerateSerialId(), magicWater.Id); EntityExtension.ShowMagicWater(typeof(MagicWater), "MagicWaterGroup", magicWaterData); } // 创建怪物生成器 IDataTable <DRMonsterCreater> dtMonsterCreater = GameEntry.DataTable.GetDataTable <DRMonsterCreater> (); DRMonsterCreater[] creaters = dtMonsterCreater.GetAllDataRows(); foreach (DRMonsterCreater creater in creaters) { MonsterCreaterData monsterCreaterData = new MonsterCreaterData(EntityExtension.GenerateSerialId(), creater.Id); monsterCreaterData.Position = new Vector3(3, 0, 3); EntityExtension.ShowMonsterCreater(typeof(MonsterCreater), "MonsterCreaterGroup", monsterCreaterData); } }
protected override void OnLoad() { dtSound = GameEntry.DataTable.GetDataTable <DRSound>(); if (dtSound == null) { throw new System.Exception("Can not get data table Sound"); } dtSoundGroup = GameEntry.DataTable.GetDataTable <DRSoundGroup>(); if (dtSoundGroup == null) { throw new System.Exception("Can not get data table SoundGroup"); } dtSoundPlayParam = GameEntry.DataTable.GetDataTable <DRSoundPlayParam>(); if (dtSoundPlayParam == null) { throw new System.Exception("Can not get data table SoundPlayParam"); } dicSoundData = new Dictionary <int, SoundData>(); dicSoundGroupData = new Dictionary <int, SoundGroupData>(); dicSoundPlayParamData = new Dictionary <int, SoundPlayParamData>(); DRSound[] dRSounds = dtSound.GetAllDataRows(); foreach (var dRSound in dRSounds) { SoundGroupData soundGroupData = null; if (!dicSoundGroupData.TryGetValue(dRSound.SoundGroupId, out soundGroupData)) { DRSoundGroup dRSoundGroup = dtSoundGroup.GetDataRow(dRSound.SoundGroupId); if (dRSoundGroup == null) { throw new System.Exception("Can not find SoundGroup id :" + dRSound.SoundGroupId); } soundGroupData = new SoundGroupData(dRSoundGroup); dicSoundGroupData.Add(dRSound.SoundGroupId, soundGroupData); } SoundPlayParamData soundPlayParamData = null; if (!dicSoundPlayParamData.TryGetValue(dRSound.SoundPlayParamId, out soundPlayParamData)) { DRSoundPlayParam dRSoundPlayParam = dtSoundPlayParam.GetDataRow(dRSound.SoundPlayParamId); if (dRSoundPlayParam == null) { throw new System.Exception("Can not find SoundPlayParam id :" + dRSound.SoundPlayParamId); } soundPlayParamData = new SoundPlayParamData(dRSoundPlayParam); dicSoundPlayParamData.Add(dRSound.SoundPlayParamId, soundPlayParamData); } DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(dRSound.AssetId); SoundData soundData = new SoundData(dRSound, dRAssetsPath, soundGroupData, soundPlayParamData); dicSoundData.Add(dRSound.Id, soundData); } }
protected override void OnLoad() { DataProjectile dataProjectile = GameEntry.Data.GetData <DataProjectile>(); if (dataProjectile == null) { Log.Error("Can't load DataProjectile"); return; } dtTower = GameEntry.DataTable.GetDataTable <DRTower>(); if (dtTower == null) { throw new System.Exception("Can not get data table Tower"); } dtTowerLevel = GameEntry.DataTable.GetDataTable <DRTowerLevel>(); if (dtTowerLevel == null) { throw new System.Exception("Can not get data table TowerLevel"); } dicTowerData = new Dictionary <int, TowerData>(); dicTowerLevelData = new Dictionary <int, TowerLevelData>(); dicTower = new Dictionary <int, Tower>(); DRTowerLevel[] drTowerLevels = dtTowerLevel.GetAllDataRows(); foreach (var drTowerLevel in drTowerLevels) { if (dicTowerLevelData.ContainsKey(drTowerLevel.Id)) { throw new System.Exception(string.Format("Data tower level id '{0}' duplicate.", drTowerLevel.Id)); } ProjectileData projectileData = dataProjectile.GetProjectileData(drTowerLevel.ProjectileData); TowerLevelData towerLevelData = new TowerLevelData(drTowerLevel, projectileData); dicTowerLevelData.Add(drTowerLevel.Id, towerLevelData); } DRTower[] drTowers = dtTower.GetAllDataRows(); foreach (var drTower in drTowers) { TowerLevelData[] towerLevelDatas = new TowerLevelData[drTower.Levels.Length]; for (int i = 0; i < drTower.Levels.Length; i++) { if (!dicTowerLevelData.ContainsKey(drTower.Levels[i])) { throw new System.Exception(string.Format("Can not find tower level id '{0}' in DataTable TowerLevel.", drTower.Levels[i])); } towerLevelDatas[i] = dicTowerLevelData[drTower.Levels[i]]; } TowerData towerData = new TowerData(drTower, towerLevelDatas); dicTowerData.Add(drTower.Id, towerData); } }
//根据配置表加载全部地点 public static void LoadAllSiteByTable(this DataNodeComponent dataNode) { IDataNode siteNode = dataNode.GetOrAddNode(Constant.DataNode.SiteList); IDataTable <DRSite> dtSite = GameEntry.DataTable.GetDataTable <DRSite>(); DRSite[] drSites = dtSite.GetAllDataRows(); foreach (DRSite drSite in drSites) { dataNode.SetData <VarSiteInfo>(drSite.Id.ToString(), new SiteInfo(drSite.Id), siteNode); } }
protected override void OnLoad() { MaxLevel = 0; dtLevel = GameEntry.DataTable.GetDataTable <DRLevel>(); if (dtLevel == null) { throw new System.Exception("Can not get data table Level"); } dicLevelData = new Dictionary <int, LevelData>(); DataWave dataWave = GameEntry.Data.GetData <DataWave>(); if (dataWave == null) { throw new System.Exception("Can not get data 'DataWave'"); } DRLevel[] dRLevels = dtLevel.GetAllDataRows(); foreach (var dRLevel in dRLevels) { SceneData sceneData = GameEntry.Data.GetData <DataScene>().GetSceneData(dRLevel.SceneId); int[] waveIds = dRLevel.WaveIds; WaveData[] waveDatas = new WaveData[waveIds.Length]; for (int i = 0; i < waveIds.Length; i++) { WaveData waveData = dataWave.GetWaveData(waveIds[i]); if (waveData == null) { throw new System.Exception("Can not find Wave Data id :" + waveIds[i]); } waveDatas[i] = waveData; } LevelData levelData = new LevelData(dRLevel, waveDatas, sceneData); dicLevelData.Add(dRLevel.Id, levelData); if (dRLevel.Id > MaxLevel) { MaxLevel = dRLevel.Id; } } // starScore = new int[3]; starScore[0] = GameEntry.Config.GetInt(Constant.Config.LevelStar1); starScore[1] = GameEntry.Config.GetInt(Constant.Config.LevelStar2); starScore[2] = GameEntry.Config.GetInt(Constant.Config.LevelStar3); Subscribe(LoadLevelFinishEventArgs.EventId, OnLoadLevelFinfish); }
public static void ShowAllSite(this EntityComponent entityComponent) { IDataTable <DRSite> dtSite = GameEntry.DataTable.GetDataTable <DRSite>(); DRSite[] dRSites = dtSite.GetAllDataRows(); foreach (var dRSite in dRSites) { entityComponent.ShowSite(new SiteData(dRSite.Id, 2) { }); } }
protected override void OnLoad() { dtPoolParam = GameEntry.DataTable.GetDataTable <DRPoolParam>(); if (dtPoolParam == null) { throw new System.Exception("Can not get data table PoolParam"); } dicPoolParam = new Dictionary <int, PoolParamData>(); DRPoolParam[] dRPoolParams = dtPoolParam.GetAllDataRows(); foreach (var dRPoolParam in dRPoolParams) { PoolParamData poolParamData = new PoolParamData(dRPoolParam); dicPoolParam.Add(dRPoolParam.Id, poolParamData); } }
protected override void OnLoad() { dtProjectile = GameEntry.DataTable.GetDataTable <DRProjectile>(); if (dtProjectile == null) { throw new System.Exception("Can not get data table PoolParam"); } dicProjectile = new Dictionary <int, ProjectileData>(); DRProjectile[] drProjectiles = dtProjectile.GetAllDataRows(); foreach (var drProjectile in drProjectiles) { ProjectileData projectileData = new ProjectileData(drProjectile); dicProjectile.Add(drProjectile.Id, projectileData); } }
protected override void OnLoad() { dtScene = GameEntry.DataTable.GetDataTable <DRScene>(); if (dtScene == null) { throw new System.Exception("Can not get data table Scene"); } dicSceneData = new Dictionary <int, SceneData>(); DRScene[] dRScenes = dtScene.GetAllDataRows(); foreach (var dRScene in dRScenes) { DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(dRScene.AssetId); SceneData sceneData = new SceneData(dRScene, dRAssetsPath); dicSceneData.Add(dRScene.Id, sceneData); } }
public void InitConfig() { //获得第一类怪物 IDataTable <DRMonster> dtMonstor = GameEntry.DataTable.GetDataTable <DRMonster>(); DRMonster[] list = dtMonstor.GetAllDataRows(); currMonstors = new List <DRMonster>(); genMonstors = new List <DRMonster>(); int lent = list.Length; for (int i = 0; i < lent; i++) { DRMonster dr = list[i]; if (dr.IsFirst()) { currMonstors.Add(dr); } } }
private void OnLoadDataTableSuccess(object sender, GameEventArgs e) { // 数据表加载成功事件 UnityGameFramework.Runtime.LoadDataTableSuccessEventArgs ne = e as UnityGameFramework.Runtime.LoadDataTableSuccessEventArgs; Debug.Log(string.Format("Load data table '{0}' success.", ne.DataTableName)); // 获取框架数据表组件 // 获得数据表 IDataTable <DRHero> dtScene = GameEntry.DataTable.GetDataTable <DRHero>(); // 获得所有行 DRHero[] drHeros = dtScene.GetAllDataRows(); Debug.Log("drHeros:" + drHeros.Length); // 根据行号获得某一行,即IDataRow中的id,自定义,而不是根据顺序 DRHero drScene = dtScene.GetDataRow(1); //或直接使用 dtScene[1] if (drScene != null) { // 此行存在,可以获取内容了 string name = drScene.Name; int HP = drScene.HP; Debug.Log("name:" + name + ", HP:" + HP); } else { // 此行不存在 } // 获得满足条件的所有行 DRHero[] drScenesWithCondition = dtScene.GetDataRows(x => x.ID > 1); // 获得满足条件的第一行 DRHero drSceneWithCondition = dtScene.GetDataRow(x => x.Name == "enemy"); if (drSceneWithCondition != null) { // 此行存在,可以获取内容了 string name = drSceneWithCondition.Name; int HP = drSceneWithCondition.HP; Debug.Log("name:" + name + ", HP:" + HP); } }
protected override void OnLoad() { dtEntity = GameEntry.DataTable.GetDataTable <DREntity>(); if (dtEntity == null) { throw new System.Exception("Can not get data table Entity"); } dtEntityGroup = GameEntry.DataTable.GetDataTable <DREntityGroup>(); if (dtEntityGroup == null) { throw new System.Exception("Can not get data table EntityGroup"); } dicEntityData = new Dictionary <int, EntityData>(); dicEntityGroupData = new Dictionary <int, EntityGroupData>(); DREntity[] drEntitys = dtEntity.GetAllDataRows(); foreach (var drEntity in drEntitys) { EntityGroupData entityGroupData = null; if (!dicEntityGroupData.TryGetValue(drEntity.EntityGroupId, out entityGroupData)) { DREntityGroup dREntityGroup = dtEntityGroup.GetDataRow(drEntity.EntityGroupId); if (dREntityGroup == null) { throw new System.Exception("Can not find EntityGroup id :" + drEntity.EntityGroupId); } PoolParamData poolParamData = GameEntry.Data.GetData <DataPoolParam>().GetPoolParamData(dREntityGroup.PoolParamId); entityGroupData = new EntityGroupData(dREntityGroup, poolParamData); dicEntityGroupData.Add(drEntity.EntityGroupId, entityGroupData); } DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(drEntity.AssetId); EntityData entityData = new EntityData(drEntity, dRAssetsPath, entityGroupData); dicEntityData.Add(drEntity.Id, entityData); } }
protected override void OnLoad() { dtItem = GameEntry.DataTable.GetDataTable <DRItem>(); if (dtItem == null) { throw new System.Exception("Can not get data table Item"); } dtItemGroup = GameEntry.DataTable.GetDataTable <DRItemGroup>(); if (dtItemGroup == null) { throw new System.Exception("Can not get data table ItemGroup"); } dicItemData = new Dictionary <int, ItemData>(); dicItemGroupData = new Dictionary <int, ItemGroupData>(); DRItem[] drItems = dtItem.GetAllDataRows(); foreach (var drItem in drItems) { ItemGroupData itemGroupData = null; if (!dicItemGroupData.TryGetValue(drItem.ItemGroupId, out itemGroupData)) { DRItemGroup dRItemGroup = dtItemGroup.GetDataRow(drItem.ItemGroupId); if (dRItemGroup == null) { throw new System.Exception("Can not find ItemGroup id :" + drItem.ItemGroupId); } PoolParamData poolParamData = GameEntry.Data.GetData <DataPoolParam>().GetPoolParamData(dRItemGroup.PoolParamId); itemGroupData = new ItemGroupData(dRItemGroup, poolParamData); dicItemGroupData.Add(drItem.ItemGroupId, itemGroupData); } DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(drItem.AssetId); ItemData itemData = new ItemData(drItem, dRAssetsPath, itemGroupData); dicItemData.Add(drItem.Id, itemData); } }
protected override void OnLoad() { dtUIForm = GameEntry.DataTable.GetDataTable <DRUIForm>(); if (dtUIForm == null) { throw new System.Exception("Can not get data table UIForm"); } dtUIGroup = GameEntry.DataTable.GetDataTable <DRUIGroup>(); if (dtUIGroup == null) { throw new System.Exception("Can not get data table UIGroup"); } dicUIData = new Dictionary <int, UIData>(); dicUIGroupData = new Dictionary <int, UIGroupData>(); DRUIForm[] drUIForms = dtUIForm.GetAllDataRows(); foreach (var drUIForm in drUIForms) { UIGroupData uiGroupData = null; if (!dicUIGroupData.TryGetValue(drUIForm.UIGroupId, out uiGroupData)) { DRUIGroup dRUIGroup = dtUIGroup.GetDataRow(drUIForm.UIGroupId); if (dRUIGroup == null) { throw new System.Exception("Can not find UIGroup id :" + drUIForm.UIGroupId); } uiGroupData = new UIGroupData(dRUIGroup); dicUIGroupData.Add(drUIForm.UIGroupId, uiGroupData); } DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(drUIForm.AssetId); UIData uiData = new UIData(drUIForm, dRAssetsPath, uiGroupData); dicUIData.Add(drUIForm.Id, uiData); } }
private void OnLoadDataTableSuccess(object sender, GameEventArgs e) { // 数据表加载成功事件 UnityGameFramework.Runtime.LoadDataTableSuccessEventArgs ne = e as UnityGameFramework.Runtime.LoadDataTableSuccessEventArgs; Log.Info("Load data table '{0}' success.", ne.DataTableName); // 获得数据表 IDataTable <DRUIForm> _dtUIForm = GameEntry.DataTable.GetDataTable <DRUIForm>(); // 获得所有行 DRUIForm[] _drUIForms = _dtUIForm.GetAllDataRows(); if (_drUIForms.Length == 0) { return; } System.Collections.Generic.Dictionary <int, System.Type> _value = new System.Collections.Generic.Dictionary <int, System.Type>(); foreach (var item in _drUIForms) { if (item != null) { // 此行存在,可以获取内容了 if (GameEntry.UI.GetUIGroup(item.UIGroupName) == null) { GameEntry.UI.AddUIGroup(item.UIGroupName); } System.Type _type = GameEntry._ILRuntime._AppDomain.GetType(item.HotfixUIFormLogic).ReflectionType; if (_type.BaseType == typeof(UnityGameFramework.Runtime.UIFormLogic)) { _value.Add(item.Id, _type); } } } if (_value == null || _value.Count <= 0) { return; } GameEntry.UI.SetHotfixUIFormLogic(_value); }
protected override void OnInit(object userData) { base.OnInit(userData); /* 创建英雄面板 */ IDataTable <DRHeroShop> dtHeroShop = GameEntry.DataTable.GetDataTable <DRHeroShop> (); DRHeroShop[] drHeroShops = dtHeroShop.GetAllDataRows(); string assetName = AssetUtility.GetUIFormAsset("UIHeroShop_PanelHero"); GameEntry.Resource.LoadAsset(assetName, new LoadAssetCallbacks( (_assetName, _asset, _duration, _userData) => { foreach (DRHeroShop drHeroShop in drHeroShops) { GameObject panelHeroObj = (GameObject)Instantiate((Object)_asset); panelHeroObj.transform.SetParent(panelHeroParent, false); UIHeroShop_PanelHero panelHero = panelHeroObj.GetComponent <UIHeroShop_PanelHero> (); panelHero.Init(drHeroShop, OnHeroPanelClick); } } )); }
public DRAssetsPath[] GetAllAssetsPathDataRaw() { return(dtAssetPath.GetAllDataRows()); }
protected override void OnLoad() { dtWave = GameEntry.DataTable.GetDataTable <DRWave>(); if (dtWave == null) { throw new System.Exception("Can not get data table Item"); } dtWaveElement = GameEntry.DataTable.GetDataTable <DRWaveElement>(); if (dtWaveElement == null) { throw new System.Exception("Can not get data table ItemGroup"); } dicWaveData = new Dictionary <int, WaveData>(); dicWaveElementData = new Dictionary <int, WaveElementData>(); DRWaveElement[] dRWaveElements = dtWaveElement.GetAllDataRows(); foreach (var dRWaveElement in dRWaveElements) { if (dicWaveElementData.ContainsKey(dRWaveElement.Id)) { Log.Error("WaveElement id duplicate:{0}.", dRWaveElement.Id); continue; } dicWaveElementData.Add(dRWaveElement.Id, new WaveElementData(dRWaveElement)); } DRWave[] dRWaves = dtWave.GetAllDataRows(); foreach (var dRWave in dRWaves) { int[] waveElementRange = dRWave.WaveElements; if (waveElementRange.Length != 2) { throw new System.Exception(string.Format("Wave data 'WaveElements' length error,current is '{0}', should be 2", waveElementRange.Length)); } int startIndex = waveElementRange[0]; int endIndex = waveElementRange[1]; if (endIndex < startIndex) { throw new System.Exception("Wave element index invaild,EndIndex should smaller than StartIndex."); } WaveElementData[] waveElementDatas = new WaveElementData[endIndex - startIndex + 1]; int index = 0; for (int i = startIndex; i <= endIndex; i++) { WaveElementData waveElementData = null; if (!dicWaveElementData.TryGetValue(i, out waveElementData)) { throw new System.Exception("Can not find WaveElementDat id :" + i); } waveElementDatas[index++] = waveElementData; } dicWaveData.Add(dRWave.Id, new WaveData(dRWave, waveElementDatas)); } }
private void doCompose() { pausebg = false; if (first == null || second == null) { Debug.LogError(string.Format("存在空 {0} {1}", first == null, second == null)); return; } Debug.Log("开始合成 .. " + first.Id + " " + second.Id); string cid = first.Id + "_" + second.Id; IDataTable <DRSynthesis> dtScene = GameEntry.DataTable.GetDataTable <DRSynthesis>(); DRSynthesis[] list = dtScene.GetAllDataRows(); DRSynthesis drScene = null; int lent = list.Length; for (int i = 0; i < lent; i++) { DRSynthesis dr = list[i]; if (dr.Id_Id.Equals(cid)) { drScene = dr; break; } } if (drScene != null) { drScene.CanCompose(); string tid = drScene.cId; Debug.Log("合成id" + drScene.cId); if (tid != null && tid != "") { //查找表 IDataTable <DRMonster> dtmon = GameEntry.DataTable.GetDataTable <DRMonster>(); DRMonster drmon = dtmon.GetDataRow(int.Parse(tid)); if (drmon != null) { DRMonster dmon = currMonstors.Find((DRMonster obj) => drmon.Id == obj.Id); if (dmon == null) { Debug.Log("添加新物种" + drmon.Id + " " + drmon.asset); addToGenList(drmon, first, second); if (drmon.Id != 200 && drmon.Id != 100) { setHp(sucAddOnce); } else if (drmon.Id == 200) { //setHp(failSub); } } else { Debug.Log("已有物种" + drmon.Id + " " + drmon.asset); if (drmon.Id != 200 && drmon.Id != 100) { setHp(sucAdd); } else if (drmon.Id == 200) { //setHp(failSub); } } //显示合成 //音效 GameEntry.Sound.PlaySound(drmon.soundId); showCompose(drmon, first, second); //显示提示 tipTxt.text = drmon.intro; eimg.SetActive(true); eimg.transform.Find("infoTxt").gameObject.GetComponent <Text>().text = drmon.intro; Invoke("hideTxt", 0.8f); //drmon.endValue = 1000; if (drmon.endValue >= 1000) { //结束 m_start = false; doEndStory(drmon); } } else { //todo 配置 //是不是平局 //if (tid.Equals("100")) //{ // //音效 // GameEntry.Sound.PlaySound(5); // clearShow(false,"ashes","灰烬"); //}else if (tid.Equals("200")) //{ // clearShow(true,"wrong","残渣"); //}else //{ clearShow(true); //} } } else { clearShow(true); } } else { clearShow(true); } }
public override void OnInitUI() { //监听自定义事件 GameMode.Event.AddListener <TestEventArgs>(OnTestEventCallback); //监听网络请求成功 GameMode.Event.AddListener <HttpResponseSuccessEventArgs>(OnHttpResponseSuccess); //网络请求失败 GameMode.Event.AddListener <HttpResponseFailEventArgs>(OnHttpResponseFail); btn_UI.onClick.AddListener(() => { GameMode.UI.OpenUI <UITestView>(); }); btn_Scene.onClick.AddListener(async() => { AsyncOperation asyncOperation = await GameMode.Scene.LoadSceneAsync("scene", "Test1", UnityEngine.SceneManagement.LoadSceneMode.Single); GameMode.Event.AddListener <SceneLoadingEventArgs>(OnSceneLoadingCallbak); GameMode.Event.AddListener <SceneLoadedEventArgs>(OnSceneLoadedCallbak); }); btn_dataTable.onClick.AddListener(() => { GameMode.DataTable.LoadDataTable <StarForce.DRScene>("Scene", GlobalManager.DataTableRootPath + "Scene"); // 获得数据表 IDataTable <StarForce.DRScene> dtScene = GameMode.DataTable.GetDataTable <StarForce.DRScene>(); // 获得所有行 StarForce.DRScene[] drScenes = dtScene.GetAllDataRows(); // 根据行号获得某一行 StarForce.DRScene drScene = dtScene.GetDataRow(2); // 或直接使用 dtScene[1] if (drScene != null) { // 此行存在,可以获取内容了 //string name = drScene.Name; string assetName = drScene.AssetName; int backgroundMusicId = drScene.BackgroundMusicId; Debug.Log("AssetName:" + assetName); } }); btn_dataNode.onClick.AddListener(() => { GameMode.Node.Set("Test", 1); GameMode.Node.Set("Test", false); GameMode.Node.Set("Test.1", 1); GameMode.Node.Set("Test0", 10000000); GameMode.Node.Set("Test1", 1.9999f); GameMode.Node.Set("Test1", 1.99900000009f); GameMode.Node.Set("Test2", "str"); GameMode.Node.Set("Test3", true); GameMode.Node.Set("Test4", false); TestDataNode a = new TestDataNode(); GameMode.Node.Set("Test4", a); }); btn_Event.onClick.AddListener(() => { GameMode.Event.Trigger(this, new TestEventArgs() { Parameters = "TriggerEvent" }); }); btn_WebRequst.onClick.AddListener(() => { //Get请求 //GameMode.WebRequest.RequestHttpGet("http://unionsug.baidu.com/su?wd=js&cb=baiduSU%27"); GameMode.WebRequest.Get("http://unionsug.baidu.com/su?wd=js&cb=baiduSU%271").OnSuccess(response => { Debug.Log(response.Text); }).Send(); GameMode.WebRequest.Get("http://unionsug.baidu.com/su?wd=js&cb=baiduSU%271").Send(); }); btn_Language.onClick.AddListener(() => { if (LocalizationManager.Language == Language.English) { GameMode.Localization.SetLanguage(Language.Chinese); } else { GameMode.Localization.SetLanguage(Language.English); } }); }