当前位置:网站首页>Combination of fairygui check box and progress bar

Combination of fairygui check box and progress bar

2022-07-06 12:42:00 SQ Liu

FairyGUI Combination of check box and progress bar

One 、 preparation

1、 New package ProgressBar

 You can create a new package based on the previous case .

 Insert picture description here

2、 New component

 Insert picture description here
 Insert picture description here

3、 Import material

Click here to download the material
 Insert picture description here

Two 、 Progress bar

1、 New progress bar

 Insert picture description here
 Insert picture description here

2、 Fine tune the progress bar

 Insert picture description here

3、 Progress bar running animation

In order to make the progress bar less monotonous , You can add an animation to it . When making the progress bar stretch , The squirrel moves to the right as the progress bar increases . That is, there is such an effect of running with , It looks more vivid .

Set correlation
 Insert picture description here
 Insert picture description here

3、 ... and 、 A drop-down box

1、 Create a new drop-down box

 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here

2、 Set the drop-down box

 Insert picture description here
 Insert picture description here

3、 The drop-down box completes the effect

 Insert picture description here

Four 、 Packaging releases

 Insert picture description here
 Insert picture description here
 Insert picture description here

5、 ... and 、Unity It shows that

 Insert picture description here
 Insert picture description here

6、 ... and 、 coded

 Insert picture description here

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 Is the progress to be loaded ,5 It takes time 
        comboBox = mainUI.GetChild("n4").asComboBox;
        comboBox.onChanged.Add(SetCompleteTime);
    }

    private void SetCompleteTime()
    {
    
        progressBar.value = 0;  // Each reload sets its progress to 0
        progressBar.TweenValue(100, Convert.ToInt32(comboBox.value));
    }
}

7、 ... and 、 Final effect

 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[SQ Liu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060913597504.html