随机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 ...
随机推荐
- grootJs 属性过滤器
index10.html <html><head> <title>属性过滤器</title> <script src="jquery-1 ...
- Git.Framework 框架随手记--ORM查询数据集合 二
一. 分组查询 在SQL中使用Group By 来对数据分组,在实际中分组中一般与聚合函数一并使用.在Git.Framework中提供了相应的分组方法 DataTable Group(T entit ...
- ncp的简单实用
'use strict';//这是一个简单的应用var Promise = require('bluebird');var ncp = require('ncp').ncp;var fs = requ ...
- web服务器
1.打破信息孤岛,实现信息的集成 2.配置文件 web.xml 定义自己的服务器应该要哪些功能! 3.tomcat 是一个servlet容器,一个web服务器. 部署:将web应用 ...
- Spring配置文件详解:<context:annotation-config/>和<context:component-scan base-package=""/>和<mvc:annotation-driven />
<context:annotation-config/> 在基于主机方式配置Spring时,Spring配置文件applicationContext.xml,你可能会见<contex ...
- (转)在WAMPSERVER下增加多版本的PHP(PHP5.3,PHP5.4,PHP5.5)支持
原文:http://www.cnblogs.com/lyongde/p/3745030.html 此文在原文的基础上改进了几个步骤,因为经本人实践,原文无法正确配置. WAMPServer可以让开发者 ...
- 替换文件最后一行中的所有e 为 E
#root@athena5plus:~# cat b northwest NW Charles Main 3.0 .98 3 ...
- 【ZOJ 3609】Modular Inverse
题 题意 求a关于m的乘法逆元 分析 a x ≡ 1 (mod m) 等价于 ax+my=1 求x的最小正数(不能是0,我就WA在这里了). 当m=1时,或者 gcd(a,m)!=1 时x不存在. 所 ...
- 45.Android 第三方开源库收集整理(转)
原文地址:http://blog.csdn.net/caoyouxing/article/details/42418591 Android开源库 自己一直很喜欢Android开发,就如博客签名一样, ...
- BZOJ1588 HNOI2002 营业额统计 [Splay入门题]
[HNOI2002]营业额统计 Time Limit: 5 Sec Memory Limit: 162 MBSubmit: 4128 Solved: 1305 Description 营业额统计 ...