随机Loading
using UnityEngine;
using System.Collections; public class Loading : MonoBehaviour
{
public bool m_IsReset;
public GameObject[] m_CurBgs;
private UI_ViewDur m_Progress;
void Start()
{
if (m_IsReset)
{
PlayerPrefs.SetInt("CurLoadingBg", );
} m_Progress = GetComponent<UI_ViewDur>();
int curBgIndex = PlayerPrefs.GetInt("CurLoadingBg");
int index1 = curBgIndex, index2 = curBgIndex, index3 = curBgIndex;
bool b1 = false, b2 = false, b3 = false; Debug.Log("当前Idengx" + curBgIndex);
if (curBgIndex != )
{
switch (curBgIndex)
{
case :
b1 = false;
b2 = true;
b3 = false;
index1 -= ;
index2 += ;
index3 += ;
PlayerPrefs.SetInt("CurLoadingBg", index2+);//
break;
case :
b1 = false;
b2 = false;
b3 = true;
index1 -= ;
index2 += -;
index3 += ;
PlayerPrefs.SetInt("CurLoadingBg", index3+);//
break;
case :
b1 = true;
b2 = false;
b3 = false;
index1 -= ;
index2 += -;
index3 += -;
PlayerPrefs.SetInt("CurLoadingBg", index1+);//
break;
}
m_CurBgs[index1].SetActive(b1);
m_CurBgs[index2].SetActive(b2);
m_CurBgs[index3].SetActive(b3);
}
else
{
for (int i = ; i < m_CurBgs.Length + ; i++)
{
if (m_CurBgs[i - ].activeSelf)
{
Debug.Log("当前CurLoadingBg=" + i);
PlayerPrefs.SetInt("CurLoadingBg", i);
}
}
}
//StartCoroutine(LoadLevel());
}
public AsyncOperation async;
IEnumerator LoadLevel()
{
//async = Application.LoadLevelAsync(Global.s_Instance.CurLoadSceneName);
async = Application.LoadLevelAsync("moou");
yield return async;
}
public int progress = ;
public float m_Var = ;
void Update()
{
if (Random.RandomRange(, ) == )
{
m_Var += Random.RandomRange(0f, 0.06f);
} m_Progress.ViewBlood(m_Var);
//m_Progress.ViewBlood(async.progress + 0.1f);
if (m_Var >= 1f)
{
Debug.Log("GIC: " + Global.s_Instance.CurLoadSceneName);
Application.LoadLevel(Global.s_Instance.CurLoadSceneName);
}
//m_Progress.value = async.progress + 0.1f;
// progress = (int)(async.progress * 100);
//Debug.Log(progress);
//Debug.Log(async.progress);
}
}
随机Loading的更多相关文章
- Loading加载小插件,用户可以选择html格式或canvas格式,自定义loading图片,canvas色彩搭配可根据个人喜好
;(function($) { $.Loading = function(options) { //暴漏插件默认值 $.Loading.defaults = { speed: 200, //弹出层淡出 ...
- 《动手实现一个网页加载进度loading》
loading随处可见,比如一个app经常会有下拉刷新,上拉加载的功能,在刷新和加载的过程中为了让用户感知到 load 的过程,我们会使用一些过渡动画来表达.最常见的比如"转圈圈" ...
- IOS随机随学
1.Objective-C是一种面向对象的语言. 2.Objective-C类声明和实现包括两个部分:接口部分和实现部分. 3.Objective-C中方法不是在“.”运算符,而是采用“[]”运算符. ...
- 游戏Loading中的小提示和Loading动画实现
学习unity1年多了,工作也1年了,因为工作需要,有几个月没接触unity Ngui啦. 学的还是不踏实.继续努力吧.由于下周就要进行新游戏的开发,这几天熟悉熟悉NGUI,今天按照现在公司以前的项目 ...
- 【代码笔记】iOS-背景色随机显示
一,效果图. 二,工程图. 三,代码. RootViewController.h RootViewController.m - (void)viewDidLoad { [super viewDidLo ...
- ML—随机森林·1
Introduction to Random forest(Simplified) With increase in computational power, we can now choose al ...
- 一个绚丽的loading动效分析与实现!
最终效果如下 从效果上看,我们需要考虑以下几个问题: 1.叶子的随机产生: 2.叶子随着一条正余弦曲线移动: 3.叶子在移动的时候旋转,旋转方向随机,正时针或逆时针: 4.叶子遇到进度条,似乎是融合进 ...
- iOS-点击视图,视图背景颜色随机更改
一.效果图 二.代码 - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the v ...
- Android 一个绚丽的loading动效分析与实现!
http://blog.csdn.net/tianjian4592/article/details/44538605 前两天我们这边的头儿给我说,有个 gif 动效很不错,可以考虑用来做项目里的loa ...
随机推荐
- IT男的”幸福”生活"续6
新的一年飘了一下,就过来了. 在过去的一年,大家都找到了自已的幸福吗? 时间在继续,人生得幸福.. 看了前面大家的回复,感觉挺开心的.像我们code Man,不可能总是coding.总得要一些生活调味 ...
- mac使用笔记
1.QQ多开 MAC中登录QQ后按CMD+N组合按键即可新打开一个QQ登录窗口 2.关闭左右摇晃鼠标放大 系统偏好设置>辅助功能>显示器,去掉“摇动鼠标以定位”前面的勾即可 3.使用ctr ...
- Bootstrap3.0学习第十五轮(大屏幕介绍、页面标题、缩略图、警示框、Well)
详情请查看 http://aehyok.com/Blog/Detail/22.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章链接:h ...
- 每天一个linux命令(32):wc命令
Linux系统中的wc(Word Count)命令的功能为统计指定文件中的字节数.字数.行数,并将统计结果显示输出. 1.命令格式: wc [选项]文件... 2.命令功能: 统计指定文件中的字节数. ...
- eclipse中安装svn插件
Eclipse安装SVN 1.help->Install New Software2.Work With,点击add name:subclipse url:http://su ...
- UVA5876 Writings on the Wall 扩展KMP
扩展KMP的简单题. #include<stdio.h> #include<string.h> #define maxn 51010 char s[maxn],t[maxn]; ...
- ORACLE数据库删除表中记录报record is locked by another user
在操作ORACLE数据库的时候,由于执行完,没有COMMIT,直接把PL/SQL关闭掉,后来导致那张表被锁住,当编辑时就会出现这个信息,record is locked by another user ...
- BZOJ3229 石子合并
Description 在一个操场上摆放着一排N堆石子.现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的得分. 试设计一个算法,计算出将N堆石 ...
- 一个完整的编译器前端-A.1 源语言
这个语言的一个程序由一个块组成,该块中包含可选的声明和语句.语法符号basic表示基本类型. program –> block block –> { decls stmts } dec ...
- JBoss7.1配置外网访问
在JBoss7.1目录jboss-as-7.1.1.Final/standalone/configuration下找到standalone.xml,找到以下的节点,在尝试了以下两种方法: 1. < ...