基于Unity3D的2d拾宝游戏(七)
来源:互联网 发布:pdf.js 跨域加载文件 编辑:程序博客网 时间:2024/06/06 08:24
讲解上一篇文章(http://blog.csdn.net/qq_29859497/article/details/72886710)中提及的UI控制实现(C#)
UI控制类(所有按钮点击时都将调用此类):
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class UIController : MonoBehaviour { public Button begin; public Button introduce; public Button member; public Button back; public Image image; public Sprite introSprite; public Sprite memberSprite; //返回开始界面,返回首页按钮点击时调用 public void ReturnStartPage() { Application.LoadLevel(0); } //开始游戏,开始游戏及再玩一次按钮点击时调用 public void BeginGame() { Application.LoadLevel(1);//点击开始按钮,进入第一关 } //显示游戏介绍,游戏介绍按钮点击时调用 public void Introduce(bool show) { SetActiveState(show); image.GetComponent<Image>().sprite = introSprite; } //显示小组成员,小组成员按钮点击时调用 public void Member(bool show) { SetActiveState(show); image.GetComponent<Image>().sprite = memberSprite; } //显示开始界面,返回按钮点击时调用 public void Back(bool show) { SetActiveState(show); } //设置界面按钮活动状态 void SetActiveState(bool show) { begin.gameObject.SetActive(show); introduce.gameObject.SetActive(show); member.gameObject.SetActive(show); back.gameObject.SetActive(!show); image.gameObject.SetActive(!show); }}
待续。
附:相关代码编写伙伴BLOG:XiaoMing 和AudioMiao ,欢迎撩。
阅读全文
1 0
- 基于Unity3D的2d拾宝游戏(七)
- 基于Unity3D的2d拾宝游戏(一)
- 基于Unity3D的2d拾宝游戏(二)
- 基于Unity3D的2d拾宝游戏(三)
- 基于Unity3D的2d拾宝游戏(四)
- 基于Unity3D的2d拾宝游戏(五)
- 基于Unity3D的2d拾宝游戏(六)
- 基于Unity3D的2d拾宝游戏(八)
- Unity3D 2D游戏开发 官方教程。(七)
- unity3d制作2d游戏的原理
- unity3d 2D游戏开发
- unity3d 2d游戏相关
- 强大的2D游戏技能特效 【unity3d教程】
- 强大的2D游戏技能特效 【unity3d教程】
- unity3d 2d游戏关于必备元素的解析
- unity3d开发2d游戏关于Assetbundle的使用
- Unity3D开发的2D游戏---《趣味推箱子》
- 用unity3D做一个简单的2D井字棋游戏
- Java关键字 标识符 常量 变量 与基本类型
- ConnectionPool
- maven项目访问jsp页面404问题
- PHP 编程中 10 个最常见的错误
- JVM监控
- 基于Unity3D的2d拾宝游戏(七)
- 关于521
- JSP数据交互
- 小米随身WiFi,Linux下AP热点驱动(开源)
- 记一次微信支付的爬坑经历
- Android:规范命名,让合作更加愉快
- pacemaker + haproxy 高可用集群加负载均衡
- 如何在Ubuntu中安装中文输入法
- 记录一次U盘修复经历