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的更多相关文章

  1. Loading加载小插件,用户可以选择html格式或canvas格式,自定义loading图片,canvas色彩搭配可根据个人喜好

    ;(function($) { $.Loading = function(options) { //暴漏插件默认值 $.Loading.defaults = { speed: 200, //弹出层淡出 ...

  2. 《动手实现一个网页加载进度loading》

    loading随处可见,比如一个app经常会有下拉刷新,上拉加载的功能,在刷新和加载的过程中为了让用户感知到 load 的过程,我们会使用一些过渡动画来表达.最常见的比如"转圈圈" ...

  3. IOS随机随学

    1.Objective-C是一种面向对象的语言. 2.Objective-C类声明和实现包括两个部分:接口部分和实现部分. 3.Objective-C中方法不是在“.”运算符,而是采用“[]”运算符. ...

  4. 游戏Loading中的小提示和Loading动画实现

    学习unity1年多了,工作也1年了,因为工作需要,有几个月没接触unity Ngui啦. 学的还是不踏实.继续努力吧.由于下周就要进行新游戏的开发,这几天熟悉熟悉NGUI,今天按照现在公司以前的项目 ...

  5. 【代码笔记】iOS-背景色随机显示

    一,效果图. 二,工程图. 三,代码. RootViewController.h RootViewController.m - (void)viewDidLoad { [super viewDidLo ...

  6. ML—随机森林·1

    Introduction to Random forest(Simplified) With increase in computational power, we can now choose al ...

  7. 一个绚丽的loading动效分析与实现!

    最终效果如下 从效果上看,我们需要考虑以下几个问题: 1.叶子的随机产生: 2.叶子随着一条正余弦曲线移动: 3.叶子在移动的时候旋转,旋转方向随机,正时针或逆时针: 4.叶子遇到进度条,似乎是融合进 ...

  8. iOS-点击视图,视图背景颜色随机更改

    一.效果图 二.代码 - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the v ...

  9. Android 一个绚丽的loading动效分析与实现!

    http://blog.csdn.net/tianjian4592/article/details/44538605 前两天我们这边的头儿给我说,有个 gif 动效很不错,可以考虑用来做项目里的loa ...

随机推荐

  1. Java并发编程-CAS

    CAS(Compare and swap)比较和替换是设计并发算法时用到的一种技术.简单来说,比较和替换是使用一个期望值和一个变量的当前值进行比较,如果当前变量的值与我们期望的值相等,就使用一个新值替 ...

  2. 第五章:Javascript语句

    在javascript中,表达式是短语,那么语句(statement)就是整句或命令.正如英文语句以句号结尾,javascript以分号结尾. 表达式计算出一个值,但语句使某件事发生. “使某件事发生 ...

  3. java通过地址获取主机名

    关键代码: try { String str=Chat.getJt().getText().toString();//获取输入内容 String[] ipstr=str.split("[.] ...

  4. android常用的弹出提示框

    我们在平时做开发的时候,免不了会用到各种各样的对话框,相信有过其他平台开发经验的朋友都会知道,大部分的平台都只提供了几个最简单的实现,如果我们想实现自己特定需求的对话框,大家可能首先会想到,通过继承等 ...

  5. 每天一个linux命令(45):route命令

    Linux系统的route 命令用于显示和操作IP路由表(show / manipulate the IP routing table).要实现两个不同的子网之间的通信,需 要一台连接两个网络的路由器 ...

  6. “耐撕”团队 2016.03.24 站立会议

    时间: 2016.03.22  17:00-17:30     18:30-19:00 成员: Z 郑蕊 * 组长 (博客:http://www.cnblogs.com/zhengrui0452/), ...

  7. Java-TreeSet

    如下: package 集合类.Set类; /** * Set不允许重复数据 */ /** * TreeSet 是用来进行集合排序的,请注意他和LinkedHashSet的区别. TreeSet是按照 ...

  8. 深入研究Struts2(一)---Struts2是什么?它的工作原理是什么?

    本文绝对原创, 欢迎转载, 但是转载请记得注明文章出处:http://blog.csdn.net/izard999/article/details/39891281 近4年都在从事Android方 面 ...

  9. struts2中把action中的值传递到jsp页面的例子

    例子: RegistAction的代码: package com.wss.action; import javax.servlet.http.HttpServletRequest; import or ...

  10. 【CodeForces 602A】C - 特别水的题3-Two Bases

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/C Description After seeing the ...