当前位置:网站首页>FairyGUI复选框与进度条的组合使用
FairyGUI复选框与进度条的组合使用
2022-07-06 09:18:00 【SQ刘】
FairyGUI复选框与进度条的组合使用
一、准备工作
1、新建包ProgressBar
可以在上一个案例的基础上接着新建包。

2、新建组件


3、导入素材
二、进度条
1、新建进度条


2、微调进度条

3、进度条跟跑动画
为了使进度条不那么单调,可以给它添加一个动画。让进度条伸缩的时候,松鼠跟着进度条的增加往右移。也就是有那么一个跟跑的效果,看起来更生动。
设置关联

三、下拉框
1、新建下拉框






2、设置下拉框


3、下拉框完成效果

四、打包发布



五、Unity中显示


六、编码实现

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using System;
public class ProgressBar : MonoBehaviour
{
private GComponent mainUI;
private GProgressBar progressBar;
private GComboBox comboBox;
void Start()
{
mainUI = GetComponent<UIPanel>().ui;
progressBar = mainUI.GetChild("n0").asProgress;
progressBar.TweenValue(100, 5); //100是要加载的进度,5是需要花费的时间
comboBox = mainUI.GetChild("n4").asComboBox;
comboBox.onChanged.Add(SetCompleteTime);
}
private void SetCompleteTime()
{
progressBar.value = 0; //每次重新加载将它的进度设置为0
progressBar.TweenValue(100, Convert.ToInt32(comboBox.value));
}
}
七、最终效果




边栏推荐
- 1041 be unique (20 points (s)) (hash: find the first number that occurs once)
- (课设第一套)1-5 317号子任务 (100 分)(Dijkstra:重边自环)
- Teach you to release a DeNO module hand in hand
- Solution to the problem of automatic login in Yanshan University Campus Network
- MySQL时间、时区、自动填充0的问题
- The dolphin scheduler remotely executes shell scripts through the expect command
- RuntimeError: cuDNN error: CUDNN_ STATUS_ NOT_ INITIALIZED
- [leetcode19] delete the penultimate node in the linked list
- NRF24L01故障排查
- [leetcode622] design circular queue
猜你喜欢

Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights

NRF24L01故障排查

Single chip Bluetooth wireless burning

level16

idea中好用的快捷键

Basic operations of databases and tables ----- modifying data tables

ORA-02030: can only select from fixed tables/views

Mp3mini playback module Arduino < dfrobotdfplayermini H> function explanation

Pat 1097 duplication on a linked list (25 points)

ESP learning problem record
随机推荐
2021.11.10汇编考试
Redis based distributed locks and ultra detailed improvement ideas
(4) Data visualization of R language -- matrix chart, histogram, pie chart, scatter chart, linear regression and strip chart
VSCode基础配置
Vscode basic configuration
What is the maximum length of MySQL varchar field
基于Redis的分布式锁 以及 超详细的改进思路
Working principle of genius telephone watch Z3
Esp8266 connects to onenet cloud platform (mqtt) through Arduino IDE
1081 rational sum (20 points) points add up to total points
js题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。
2021.11.10 compilation examination
JS變量類型以及常用類型轉換
Compilation principle: preprocessing of source program and design and implementation of lexical analysis program (including code)
idea中导包方法
Force buckle 1189 Maximum number of "balloons"
Use of lists
[offer18] delete the node of the linked list
Basic operations of databases and tables ----- classification of data
MySQL takes up too much memory solution
