移动端测试
This commit is contained in:
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@ -94,7 +95,7 @@ public class ChartDataUpdateController : Singleton<ChartDataUpdateController>
|
||||
{
|
||||
bar.series[index].label.formatter = "{c:f2}";
|
||||
}
|
||||
|
||||
|
||||
List<BarData> barData = JsonDataTool.Inst.JsonToOptionList<BarData>(data);
|
||||
|
||||
bar.series[index].ClearData();
|
||||
@ -121,7 +122,7 @@ public class ChartDataUpdateController : Singleton<ChartDataUpdateController>
|
||||
/// <param name="index">UI层</param>
|
||||
/// <param name="pie">饼图Chart载体</param>
|
||||
/// <param name="data">更新数据(Json)</param>
|
||||
void PieUpdate(int index, BaseChart pie, string data,Text text, int plan,string format)
|
||||
void PieUpdate(int index, BaseChart pie, string data, Text text, int plan, string format)
|
||||
{
|
||||
List<PieData> pieData = JsonDataTool.Inst.JsonToOptionList<PieData>(data);
|
||||
float sum = 0;
|
||||
@ -136,7 +137,7 @@ public class ChartDataUpdateController : Singleton<ChartDataUpdateController>
|
||||
}
|
||||
if (plan >= 0 && text != null)
|
||||
{
|
||||
text.text = string.Format("{0:" + format + "}%", (pie.series[index].data[plan].data[1] / sum)*100);
|
||||
text.text = string.Format("{0:" + format + "}%", (pie.series[index].data[plan].data[1] / sum) * 100);
|
||||
}
|
||||
pie.series[index].animation.FadeIn();
|
||||
}
|
||||
@ -159,7 +160,7 @@ public class ChartDataUpdateController : Singleton<ChartDataUpdateController>
|
||||
}
|
||||
if (plan >= 0 && text != null)
|
||||
{
|
||||
text.text = string.Format("{0:"+ format +"}%", (ring.series[index].data[plan].data[0] / ring.series[index].data[plan].data[1]) * 100);
|
||||
text.text = string.Format("{0:" + format + "}%", (ring.series[index].data[plan].data[0] / ring.series[index].data[plan].data[1]) * 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,7 +222,8 @@ public class Chart
|
||||
public Text text; // 显示进度的UI
|
||||
public string format = "f0"; // 格式(小数点后位数)
|
||||
|
||||
public Chart(UIType type,int index,string url,int plan,string format) {
|
||||
public Chart(UIType type, int index, string url, int plan, string format)
|
||||
{
|
||||
this.type = type;
|
||||
this.index = index;
|
||||
this.url = url;
|
||||
|
@ -13,13 +13,17 @@ public class LogoController : MonoBehaviour
|
||||
LogoUpdate();
|
||||
}
|
||||
|
||||
void LogoUpdate() {
|
||||
GetComponent<Text>().text = File.ReadAllText(Application.streamingAssetsPath + "\\Data\\测试数据\\首页\\Logo.txt");
|
||||
void LogoUpdate()
|
||||
{
|
||||
WebRequsetTool.Inst.Get(Application.streamingAssetsPath + "\\Data\\测试数据\\首页\\Logo.txt", (str) =>
|
||||
{
|
||||
GetComponent<Text>().text = str;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@ -11,6 +10,7 @@ public class RawImageController : MonoBehaviour
|
||||
|
||||
public string Name;
|
||||
public List<Texture2D> Images = new List<Texture2D>();
|
||||
private List<Texture2D> TempImages = new List<Texture2D>();
|
||||
|
||||
private string ImagePath = Application.streamingAssetsPath + "\\Data\\测试数据\\智慧党建\\图片\\";
|
||||
private int CurrentIndex = 0;
|
||||
@ -37,6 +37,8 @@ public class RawImageController : MonoBehaviour
|
||||
|
||||
private void ImageController(int index)
|
||||
{
|
||||
if (Images.Count == 0)
|
||||
return;
|
||||
CurrentIndex += index;
|
||||
int i = CurrentIndex % Images.Count;
|
||||
|
||||
@ -56,22 +58,23 @@ public class RawImageController : MonoBehaviour
|
||||
|
||||
private void ImageDataUpate()
|
||||
{
|
||||
Images.Clear();
|
||||
|
||||
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
// string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
WebRequsetTool.Inst.Get(path + "\\Images.txt", (str) =>
|
||||
{
|
||||
if (file.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) || file.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
|
||||
TempImages.Clear();
|
||||
string[] files = str.Split("\r\n");
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
// Images.Add(GetTextureByString(SetImageToString(file)));
|
||||
WebRequsetTool.Inst.GetTexture(file, (texture) =>
|
||||
WebRequsetTool.Inst.GetTexture(path + "\\" + file, (texture) =>
|
||||
{
|
||||
Images.Add(texture);
|
||||
TempImages.Add(texture);
|
||||
Images = TempImages;
|
||||
ImageController(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ImageController(0);
|
||||
});
|
||||
}
|
||||
|
||||
private void ImageUpdate(int i)
|
||||
|
Reference in New Issue
Block a user