unity基础开发----页面加载动画代码
2014-10-08 09:14
651 查看
using UnityEngine; using System.Collections; /// <summary> /// Loading manager. /// /// This Script handles the loading of the Main scene in background /// displaying a loading animation while the scene is being loaded /// </summary> public class LoadingManager : MonoBehaviour { #region PRIVATE_MEMBER_VARIABLES private Texture Spinner; private bool mChangeLevel = true; #endregion // PRIVATE_MEMBER_VARIABLES #region UNITY_MONOBEH***IOUR_METHODS void Awake() { Resources.UnloadUnusedAssets(); System.GC.Collect(); Spinner = Resources.Load("GUI/spinner_XHigh") as Texture; } void Start() { //卸载 Resources.UnloadUnusedAssets(); System.GC.Collect(); Application.backgroundLoadingPriority = ThreadPriority.Low; mChangeLevel = true; } void Update() { if (mChangeLevel) { LoadUserDefTargetsScene(); mChangeLevel = false; } } void OnGUI() { Matrix4x4 oldMatrix = GUI.matrix; float thisAngle = Time.frameCount * 4; Rect thisRect = new Rect(Screen.width / 2.0f - Spinner.width / 2f, Screen.height / 2.0f - Spinner.height / 2f, Spinner.width, Spinner.height); //旋转 GUIUtility.RotateAroundPivot(thisAngle, thisRect.center); GUI.DrawTexture(thisRect, Spinner); //矩阵 GUI.matrix = oldMatrix; } #endregion UNITY_MONOBEH***IOUR_METHODS #region PRIVATE_METHODS private void LoadUserDefTargetsScene() { Application.LoadLevelAsync("2-Penguin"); } #endregion PRIVATE_METHODS }
相关文章推荐
- unity基础开发----unity中的UV动画实现代码
- cocos2d-js 开发基础练习代码(1)——熟悉场景加载,精灵,动画使用等
- unity基础开发-- 动态加载游戏对象或文件
- unity基础开发----外部加载资源AssetBundles
- Unity基础开发----用unity自带Animation组件制作动画
- unity基础开发----延迟等待执行代码
- iOS开发中在加载页面添加菊花动画(非第三方)
- unity基础开发 ----Unity3D 4.0新功能:Mecanim动画系统基础教程
- unity基础开发----延迟等待执行代码
- 基于css3炫酷页面加载动画特效代码
- unity基础开发----常用代码Unity中解析XML
- Unity动画 代码加载动画,可复用
- unity基础开发----物品展示必备代码(旋转,缩放)
- unity基础开发 ----Unity3D 4.0新功能:Mecanim动画系统基础教程
- 学习笔记:Unity战斗卡牌游戏(三)-----代码加载预设 及 Tween动画使用及播放回掉
- unity基础开发----控制播放动画片段、动画倒播
- 在aps.net开发时,改变页面对应的js代码后,重新加载页面后js代码没有加载为最新版本?
- unity基础开发----GUI实用代码
- 【游戏开发】[用代码创建unity5.X的动画状态机]