// Use this for initialization void Start() { ResMgr.Init(); CubeMgr.Instance.Init(); GameMgr.Instance.Init(); }
void Start() { ResMgr.Init(); //添加启动模块 //gameObject.AddComponent<StartProcessModule>(); }
public void ReplaceVoiceTest() { #if UNITY_EDITOR UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1); #endif ResMgr.Init(); var loader = ResLoader.Allocate(); // 提前预加载,否则会进行异步加载 loader.LoadSync <AudioClip>("sound1"); loader.LoadSync <AudioClip>("failed1"); AudioKit.Settings.IsVoiceOn.Value = true; AudioKit.PlayVoice("sound1"); Assert.AreEqual(AudioKit.VoicePlayer.AudioSource.clip.name, "sound1"); Assert.IsTrue(AudioKit.VoicePlayer.AudioSource.isPlaying); AudioKit.PlayVoice("failed1"); Assert.AreEqual(AudioKit.VoicePlayer.AudioSource.clip.name, "failed1"); loader.Recycle2Cache(); loader = null; }
// Use this for initialization IEnumerator Start() { ResMgr.Init(); SpriteRenderer redRenderer = GameObject.Find("Red").GetComponent <SpriteRenderer>(); Texture2D redTexture = resLoader.LoadAsset <Texture2D>("Red"); Sprite redSprite = Sprite.Create(redTexture, new Rect(0, 0, redTexture.width, redTexture.height), Vector2.one * 0.5f); redRenderer.sprite = redSprite; yield return(new WaitForSeconds(3f)); Resources.UnloadAsset(redTexture); SpriteRenderer blueRenderer = GameObject.Find("Blue").GetComponent <SpriteRenderer>(); Texture2D blueTexture = resLoader.LoadAsset <Texture2D>("Blue"); Sprite blueSprite = Sprite.Create(blueTexture, new Rect(0, 0, blueTexture.width, blueTexture.height), Vector2.one * 0.5f); blueRenderer.sprite = blueSprite; yield return(new WaitForSeconds(3f)); Resources.UnloadAsset(blueTexture); SpriteRenderer greenRenderer = GameObject.Find("Green").GetComponent <SpriteRenderer>(); Texture2D greenTexture = resLoader.LoadAsset <Texture2D>("Green"); Sprite greenSprite = Sprite.Create(greenTexture, new Rect(0, 0, greenTexture.width, greenTexture.height), Vector2.one * 0.5f); greenRenderer.sprite = greenSprite; yield return(new WaitForSeconds(3f)); Resources.UnloadAsset(greenTexture); }
public void MusicVolumeTest() { #if UNITY_EDITOR UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1); #endif ResMgr.Init(); var loader = ResLoader.Allocate(); // 提前预加载,否则会进行异步加载 loader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsMusicOn.Value = true; AudioKit.Settings.MusicVolume.Value = 0.5f; AudioKit.PlayMusic("sound1"); Assert.AreEqual(AudioKit.MusicPlayer.AudioSource.volume, 0.5f); AudioKit.Settings.MusicVolume.Value = 1.0f; Assert.AreEqual(AudioKit.MusicPlayer.AudioSource.volume, 1.0f); loader.Recycle2Cache(); loader = null; }
public void PauseAndResumeMusicTest() { #if UNITY_EDITOR UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1); #endif ResMgr.Init(); var loader = ResLoader.Allocate(); // 提前预加载,否则会进行异步加载 loader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsMusicOn.Value = true; AudioKit.PlayMusic("sound1"); AudioKit.PauseMusic(); Assert.IsFalse(AudioKit.MusicPlayer.AudioSource.isPlaying); AudioKit.ResumeMusic(); Assert.IsTrue(AudioKit.MusicPlayer.AudioSource.isPlaying); loader.Recycle2Cache(); loader = null; }
public void IsMusicOnTest() { #if UNITY_EDITOR UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1); #endif ResMgr.Init(); var loader = ResLoader.Allocate(); // 提前预加载,否则会进行异步加载 loader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsMusicOn.Value = false; AudioKit.PlayMusic("sound1"); Assert.IsFalse(AudioKit.MusicPlayer.AudioSource); Assert.Throws <NullReferenceException>(() => { var name = AudioKit.MusicPlayer.AudioSource.clip.name; }); loader.Recycle2Cache(); loader = null; }
private void Awake() { DontDestroyOnLoad(this.gameObject); Instance = this; ResMgr.Init(); LuaMain = LuaMain.getInstance(); }
private void Awake() { DontDestroyOnLoad(this.gameObject); Instance = this; ResMgr.Init(); BaseOutlet.Instance.Init(); }
// public LoadingWnd loadingWnd; // public DynamicWnd dynamicWnd; private void Start() { DontDestroyOnLoad(this); PECommon.Log("Game Start..."); ResMgr.Init(); Init(); }
private void Awake() { ResMgr.Init(); UIMgr.SetResolution(352, 636, 0); UIMgr.OpenPanel <UIGamePanel>(); }
private void Awake() { ResMgr.Init(); //UIMgr.SetResolution(1024, 768, 1.0f); UIMgr.SetResolution(Screen.width, Screen.height, 1.0f); DontDestroyOnLoad(UIManager.Instance); }
void Start() { ResMgr.Init(); UIMgr.OpenPanel <UIConnect>(UILevel.PopUI); QEventSystem.RegisterEvent(101, (x, y) => { UIMgr.ClosePanel <UIConnect>(); UIMgr.OpenPanel <UIMsg>(); }); }
// Use this for initialization private void Awake() { MakeFSM(); ResMgr.Init(); UIMgr.OpenPanel <UIHomePanel>(); }
private IEnumerator Start() { ResMgr.Init(); yield return(new WaitForEndOfFrame()); UIMgr.SetResolution(1280, 720, 0); UIMgr.OpenPanel <UITest>(UILevel.Common); }
private void Start() { ResMgr.Init(); AudioManager.Instance.SendMsg(new AudioSoundMsg("TestSound")); AudioManager.Instance.SendMsg(new AudioMusicMsg("BackGroundMusic")); AudioManager.Instance.SendMsg(new AudioStopMusicMsg()); }
// 游戏逻辑初始化 public void AppInit(GameObject goMain, NBsn.MMain Main) { Log.Info("NBsn.CGlobal.AppInit()"); m_goMain = goMain; m_Main = Main; m_tfMain = m_goMain.transform; Coroutine.Init(m_Main); ResMgr.Init(); UIMgr.Init(m_tfMain.Find("UI")); }
private void Start() { ResMgr.Init(); mResLoader.LoadSync <GameObject>("Resources/GameObject") .Instantiate() .Name("这是使用ResKit加载的对象"); mResLoader.LoadSync <GameObject>("AssetObj") .Instantiate() .Name("这是使用通过 AssetName 加载的对象"); }
public void Init() { ResMgr.Init(); //初始化所有的 enemy 预制体 foreach (var monster in GlobalManager.Instance.GameDevSetting.dic_monster_path) { if (!dic_name_enemyGO.ContainsKey(monster.Key)) { dic_name_enemyGO[monster.Key] = mEnemyLoader.LoadSync <GameObject>(monster.Value); } } }
// Use this for initialization private IEnumerator Start() { ResMgr.Init(); // net image mResLoader.Add2Load( "http://qframework.io/content/images/2017/07/-----2017-07-01-12-14-56.png".ToNetImageResName(), delegate(bool b, IRes res) { Log.E(b); if (b) { var texture2D = res.Asset as Texture2D; transform.Find("Image").GetComponent <Image>().sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } }); mResLoader.LoadAsync(); yield return(new WaitForSeconds(5.0f)); mResLoader.Recycle2Cache(); mResLoader = null; yield return(new WaitForSeconds(1.0f)); mResLoader = ResLoader.Allocate(); // local image var localImageUrl = "file://" + Application.persistentDataPath + "/Workspaces/lM1wmsLQtfzRQc6fsdEU.jpg"; mResLoader.Add2Load(localImageUrl.ToLocalImageResName(), delegate(bool b, IRes res) { Log.E(b); if (b) { var texture2D = res.Asset as Texture2D; transform.Find("Image").GetComponent <Image>().sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } }); mResLoader.LoadAsync(); yield return(new WaitForSeconds(5.0f)); mResLoader.Recycle2Cache(); mResLoader = null; }
// Start is called before the first frame update void Start() { mModel = TodoList.Load(); ResMgr.Init(); UIMgr.SetResolution(640, 1136, 0); UIMgr.OpenPanel <UITodoList>(new UITodoListData() { Model = mModel }); }
static public int Init(IntPtr l) { try { ResMgr self = (ResMgr)checkSelf(l); var ret = self.Init(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
// Use this for initialization void Start() { if (!instance) { instance = this; } else { Destroy(this); return; } ResMgr.Init(); UIPanel.OpenPanel <UIGamePanel>(); }
private void Start() { ResMgr.Init(); mResLoader.LoadSync <GameObject>("resources://GameObject") .Instantiate() .Name("这是使用ResKit加载的对象"); mResLoader.LoadSync <GameObject>("AssetObj") .Instantiate() .Name("这是使用通过 AssetName 加载的对象"); mResLoader.LoadSync <GameObject>("assetobj_prefab", "AssetObj") .Instantiate() .Name("这是使用通过 AssetName 和 AssetBundle 加载的对象"); }
public void PlaySound() { ResMgr.Init(); var resLoader = ResLoader.Allocate(); resLoader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsSoundOn.Value = true; var player = AudioKit.PlaySound("sound1"); Assert.IsTrue(player.AudioSource.isPlaying); Assert.AreEqual(player.AudioSource.clip.name, "sound1"); resLoader.Recycle2Cache(); resLoader = null; }
public void SoundOffTest() { ResMgr.Init(); var resLoader = ResLoader.Allocate(); resLoader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsSoundOn.Value = true; var player = AudioKit.PlaySound("sound1"); AudioKit.Settings.IsSoundOn.Value = false; Assert.IsFalse(player.AudioSource.isPlaying); resLoader.Recycle2Cache(); resLoader = null; }
private List <int> missionCompletedRecord; // 事件完成的记录 private void Awake() { // 注册 IOC App.Container.RegisterInstance <LevelManager>(this); // 注册聚会通知的提醒 TypeEventSystem.Register <PartyNotification>(OnPartyNotify); // 注册活动成功/失败的通知提醒 TypeEventSystem.Register <MissionCompletedNotification>(OnMissionCompleteNotify); TypeEventSystem.Register <MissionExpelledNotification>(OnMissionExpelledNotify); ResMgr.Init(); resLoader = ResLoader.Allocate(); InitTargetPositions(); InitEvent2Pos(); InitPartyPos2Human(); InitPartyTipTexts(); InitRecordList(); }
void Start() { ResMgr.Init(); UIMgr.OpenPanel <UITestUniRx>(); Dictionary <string, Action> m_FuncList = new Dictionary <string, Action>(); m_FuncList.Add("a", DoubleClick); //双击 m_FuncList.Add("s", WWW); //WWW m_FuncList.Add("d", Property); //属性监听 m_FuncList.Add("f", Coroutine); //和unity协程 m_FuncList.Add("g", ReactiveSubscribe); //收集器 m_FuncList.Add("h", TsfSubscribe); //transform ObservableLogger.Listener .Subscribe(_ => Debug.Log(_)); Observable.EveryUpdate() .Do((x) => { if (Input.inputString != string.Empty && Input.inputString != " ") { Debug.Log(Input.inputString); if (m_FuncList.ContainsKey(Input.inputString)) { if (CurrentSub != null) { CurrentSub.Dispose(); } m_FuncList[Input.inputString].InvokeGracefully(); } } }) .Subscribe() .AddTo(this); Observable.EveryUpdate() .Where(_ => Input.GetKeyDown(KeyCode.Space)) .Subscribe(_ => { disposables.Dispose(); disposables.Clear(); }) .AddTo(this); }
private void Awake() { ResMgr.Init(); AudioManager.On(); UIMgr.SetResolution(1334, 750, CanvasWidthOrHeightUtil.GetCanvasScaler()); Observable.EveryUpdate().Where(_ => Input.GetKeyDown(KeyCode.Escape)).Subscribe(_ => { int mSiblingIndex = -1; int index = -1; List <string> Keys = new List <string>(UIManager.Instance.mAllUI.Keys); for (int i = 0; i < UIManager.Instance.mAllUI.Count; i++) { int siblingIndex = UIManager.Instance.mAllUI[Keys[i]].Transform.GetSiblingIndex(); if (siblingIndex > mSiblingIndex) { mSiblingIndex = siblingIndex; index = i; } } if (index != -1) { if ("MainPanel".Equals(Keys[index])) { Application.Quit(); } //BookDayListPanel else if ("LoginPanel".Equals(Keys[index]) || "UpdateTipPanel".Equals(Keys[index]) || "TipPanel".Equals(Keys[index]) || "MessageMaskPanel".Equals(Keys[index]) || "MainGuidePanel".Equals(Keys[index]) || "MedalAnimationPanel".Equals(Keys[index]) || "BookDayListPanel".Equals(Keys[index])) { } else { UIManager.Instance.Back(Keys[index]); } } }); }
public void SoundVolumeTest() { ResMgr.Init(); var resLoader = ResLoader.Allocate(); resLoader.LoadSync <AudioClip>("sound1"); AudioKit.Settings.IsSoundOn.Value = true; var player = AudioKit.PlaySound("sound1"); AudioKit.Settings.SoundVolume.Value = 0.5f; Assert.AreEqual(player.AudioSource.volume, 0.5f); AudioKit.Settings.SoundVolume.Value = 1.0f; Assert.AreEqual(player.AudioSource.volume, 1.0f); resLoader.Recycle2Cache(); resLoader = null; }