随机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 ...
随机推荐
- mac 80端口映射 配置
mac 80端口映射 配置 macbook 下,要绑定 80 端口的话. 一种方式是用 root 权限启动,即 sudo 启动服务进程.但 sudo 指令存在一定的安全问题,能不使用的情况下我们都尽量 ...
- Lua语言的特别之处
所谓特别,是相对的,是相对别的主流语言而言,有些也可能只是我个人看法. 1. 函数定义与调用,与代码位置的先后顺序有关,例如 calculate() function calculate() .... ...
- 年前辞职-WCF入门学习(3)
前言 [2了,刚写好的,手贱,点了删除,还真TMD的删除了,只好重写] 今天周六,去同事家聚了一个餐,感觉各种豪华. 废话不多说,前两集大致介绍了一下什么是WCF以及和WCF相关的WebService ...
- MyEclipse 启动报错:'Building workspace' has encountered a problem解决方法
转载于:http://blog.csdn.net/v123411739/article/details/42645159 每次MyEclipse工作空间报错如下:'Building workspace ...
- JPanel设置图片
package com.gr.db; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class We ...
- JWPlayer中字幕文件的配置
最近应项目要求研究JWPlayer,视研究进度可能会将解决的问题或者一些配置方法写在这里. jwplayer支持vtt和srt格式的字幕文件,在视频中可以选择加载多个字幕文件(常用于多语言字幕),并且 ...
- codevs 1360 xth砍树 线段树不能再水的题了
连标记都不用打.. #include<cstdio> #include<cstring> #include<algorithm> using namespace s ...
- poj1679 kruskal
判断最小生成树是否唯一.kruskal时记录需要的边,然后枚举删除它们,每次删除时进行kruskal,如果值未变,表明不唯一. #include<stdio.h> #include< ...
- Java基础-多线程
介绍 操作系统能同时运行几个程序,每个独立运行的程序又称之为进程. 对于同一个程序,它又可以分成若干个独立的执行流,我们称之为线程.线程提供了多任务处理的能力 用进程和线程的观点来研究软件是当今普遍采 ...
- 【UVA 11078】BUPT 2015 newbie practice #2 div2-A -Open Credit System
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102419#problem/A In an open credit system, the ...