public static void SetSpritePath(this Image image, string loadPath) { loadPath = ABPathUtilities.GetTexturePath(loadPath); var xImage = _GetXImageOrCreate(ref image); xImage.SetSpritePath(loadPath); }
public GameObject OpenUIPanel(string panelName) { string panelPath = ABPathUtilities.GetUIPath(panelName); GameObject go = ResourcesMgr.Instance.Instantiate(panelPath); return(go); }
public static void SetSpritePathAsync(this Image image, string loadPath, Action callback) { loadPath = ABPathUtilities.GetTexturePath(loadPath); var xImage = _GetXImageOrCreate(ref image); xImage.SetSpritePathAsync(loadPath, callback); }
public static Task SetSpritePathAsync(this Image image, string loadPath) { loadPath = ABPathUtilities.GetTexturePath(loadPath); var xImage = _GetXImageOrCreate(ref image); return(xImage.SetSpritePathAsync(loadPath)); }
private IEnumerator LoadSceneAsync(string sceneName) { yield return(null); string scenePath = ABPathUtilities.GetScenePath(sceneName); loadingAsyncOperation = Assets.LoadSceneAsync(scenePath, false); while (!loadingAsyncOperation.isDone) { yield return(null); } }
//异步加载场景 public void LoadSceneAsync(string sceneName, Action callback = null) { string scenePath = ABPathUtilities.GetScenePath(sceneName); SceneAssetRequest sceneAssetRequest = Assets.LoadSceneAsync(scenePath, false); sceneAssetRequest.completed += (arq) => { if (callback != null) { callback(); callback = null; } }; }
/// <summary> /// 加载特效 /// </summary> /// <param name="go">特效父节点</param> /// <param name="Url">Path</param> /// <param name="destroyTime">加载后多久删除</param> public void EffectPerfabOnLoad(GameObject go, string effectPath, float destroyTime = 0) { effectPath = ABPathUtilities.GetEffectPath(effectPath); LoadPerfabOnShow lpos = go.GetComponent <LoadPerfabOnShow>(); if (!lpos) { lpos = go.AddComponent <LoadPerfabOnShow>(); lpos.EffectGo = null; lpos.prefabUrl = effectPath; lpos.StartLoad(); } lpos.m_DestroyTime = destroyTime; lpos.isForceClose = false; lpos.m_StartTime = 0; }
public override void Start(FUI5V5Map self) { Unit unit = UnitComponent.Instance.MyUnit; HeroDataComponent heroDataComponent = unit.GetComponent <HeroDataComponent>(); NodeDataForHero mNodeDataForHero = heroDataComponent.NodeDataForHero; self.SmallMapSprite.onRightClick.Add(this.AnyEventHandler); self.Btn_GMController_Enable.self.visible = false; self.Btn_GMController_Disable.self.onClick.Add(() => { self.Btn_GMController_Disable.Visible = false; self.Btn_GMController_Enable.Visible = true; self.Par_GMControllerDis.Play(); }); self.Btn_GMController_Enable.self.onClick.Add(() => { self.Btn_GMController_Disable.Visible = true; self.Btn_GMController_Enable.Visible = false; self.Part_GMControllerEnable.Play(); }); self.Btn_CreateSpiling.self.onClick.Add(() => { SessionComponent.Instance.Session.Send(new Actor_CreateSpiling() { X = unit.Position.x, Y = unit.Position.y, Z = unit.Position.z, ParentUnitId = unit.Id }); ETModel.Log.Info($"发送请求木桩父实体id:{unit.Id}"); }); GameObject HeroAvatars = ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadAsset <GameObject>(ABPathUtilities.GetTexturePath("HeroAvatars")); GameObject HeroSkillIcons = ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadAsset <GameObject>(ABPathUtilities.GetTexturePath("HeroSkillIcons")); self.HeroAvatarLoader.texture = new NTexture(HeroAvatars.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.HeroAvatar).texture); self.SkillTalent_Loader.texture = new NTexture(HeroSkillIcons.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.Talent_SkillSprite).texture); self.SkillQ_Loader.texture = new NTexture(HeroSkillIcons.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.Q_SkillSprite).texture); self.SkillW_Loader.texture = new NTexture(HeroSkillIcons.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.W_SkillSprite).texture); self.SkillE_Loader.texture = new NTexture(HeroSkillIcons.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.E_SkillSprite).texture); self.SkillR_Loader.texture = new NTexture(HeroSkillIcons.GetTargetObjectFromRC <Sprite>(mNodeDataForHero.R_SkillSprite).texture); self.AttackInfo.text = heroDataComponent.GetAttribute(NumericType.Attack).ToString(); self.ExtraAttackInfo.text = heroDataComponent.GetAttribute(NumericType.AttackAdd).ToString(); self.MagicInfo.text = heroDataComponent.GetAttribute(NumericType.MagicStrength).ToString(); self.ExtraMagicInfo.text = heroDataComponent.GetAttribute(NumericType.MagicStrengthAdd).ToString(); self.ArmorInfo.text = heroDataComponent.GetAttribute(NumericType.Armor).ToString(); self.ArmorpenetrationInfo.text = heroDataComponent.GetAttribute(NumericType.ArmorPenetration).ToString(); self.SpellResistanceInfo.text = heroDataComponent.GetAttribute(NumericType.MagicResistance).ToString(); self.MagicpenetrationInfo.text = heroDataComponent.GetAttribute(NumericType.MagicPenetration).ToString(); self.AttackSpeedInfo.text = heroDataComponent.GetAttribute(NumericType.AttackSpeed).ToString(); self.SkillCDInfo.text = heroDataComponent.GetAttribute(NumericType.SkillCD).ToString(); self.CriticalstrikeInfo.text = heroDataComponent.GetAttribute(NumericType.CriticalStrikeProbability).ToString(); self.MoveSpeedInfo.text = heroDataComponent.GetAttribute(NumericType.Speed).ToString(); self.RedText.text = $"{heroDataComponent.GetAttribute(NumericType.Hp)}/{heroDataComponent.GetAttribute(NumericType.MaxHp)}"; self.BlueText.text = $"{heroDataComponent.GetAttribute(NumericType.Mp)}/{heroDataComponent.GetAttribute(NumericType.MaxMp)}"; self.RedProBar.self.max = heroDataComponent.GetAttribute(NumericType.MaxHp); self.RedProBar.self.value = heroDataComponent.GetAttribute(NumericType.Hp); self.BlueProBar.self.max = heroDataComponent.GetAttribute(NumericType.MaxMp); self.BlueProBar.self.value = heroDataComponent.GetAttribute(NumericType.Mp); self.SkillTalent_CDInfo.visible = false; self.SkillTalent_Bar.Visible = false; self.SkillQ_CDInfo.visible = false; self.SkillQ_Bar.Visible = false; self.SkillW_CDInfo.visible = false; self.SkillW_Bar.Visible = false; self.SkillE_CDInfo.visible = false; self.SkillE_Bar.Visible = false; self.SkillR_CDInfo.visible = false; self.SkillR_Bar.Visible = false; self.SkillD_CDInfo.visible = false; self.SkillD_Bar.Visible = false; self.SkillF_CDInfo.visible = false; self.SkillF_Bar.Visible = false; }
public static async ETVoid EnterMapAsync() { try { // 切换到map场景 // 加载场景资源 await ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadSceneAsync(ABPathUtilities.GetScenePath(SceneType.Map)); // 创建5v5游戏 M5V5GameFactory.CreateM5V5Game(); // 临时引用5v5游戏 M5V5Game m5V5Game = Game.Scene.GetComponent <M5V5GameComponent>().m_5V5Game; G2C_EnterMap g2CEnterMap = await ETModel.SessionComponent.Instance.Session.Call(new C2G_EnterMap()) as G2C_EnterMap; //ETModel.Log.Info($"{DateTime.UtcNow}处理完成服务端发来的进入Map后的信息"); PlayerComponent.Instance.MyPlayer.UnitId = g2CEnterMap.UnitId; // 添加点击地图寻路组件 m5V5Game.AddComponent <MapClickCompoent>(); ETModel.Game.EventSystem.Run(ETModel.EventIdType.CloseLoadingUI); } catch (Exception e) { Log.Error(e); } }
public static string GetText(string key) { try { GameObject config = ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadAsset <GameObject>(ABPathUtilities.GetNormalConfigPath("Config")); string configStr = config.GetTargetObjectFromRC <TextAsset>(key).text; return(configStr); } catch (Exception e) { throw new Exception($"load config file fail, key: {key}", e); } }
//同步加载场景 public async void LoadScene(string sceneName) { string scenePath = ABPathUtilities.GetScenePath(sceneName); SceneAssetRequest sceneAssetRequest = await SceneAsync(scenePath); }