mod finish ! 完成团型文化元素的修改
parent
a3fd04b239
commit
8c532233fa
File diff suppressed because it is too large
Load Diff
|
@ -73,5 +73,36 @@ public class ExcelManager : SingleManager<ExcelManager>
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveAndExpIndex(SaveExcelData.SaveExcelDataInfo info, int index)
|
||||||
|
{
|
||||||
|
string path = Application.streamingAssetsPath + "/程序输出数据" + DateTime.Now.Ticks + ".xlsx";
|
||||||
|
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
|
||||||
|
using (var pck = new ExcelPackage(fs))
|
||||||
|
{
|
||||||
|
var sheet = pck.Workbook.Worksheets.Add("Sheet1");
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
string[] hands = new[] { "选手ID", "选手(如没有内容属于正常情况)", "团型", "文化元素" };
|
||||||
|
for (int i = 0; i < hands.Length; i++)
|
||||||
|
{
|
||||||
|
sheet.SetValue(1, i + 2, hands[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var j = 0; j < info.strings.Length; j++)
|
||||||
|
{
|
||||||
|
//第0行、列留白
|
||||||
|
// sheet.Cells[i + 2, j + 2].Value = data.infos[i].strings[j];
|
||||||
|
|
||||||
|
sheet.SetValue(index + 2, j + 2, info.strings[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pck.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
public override void Enter()
|
public override void Enter()
|
||||||
{
|
{
|
||||||
base.Enter();
|
base.Enter();
|
||||||
UIManager.Instance.OpenPanel(PanelType.Home);
|
UIManager.Instance.OpenPanel(PanelType.Draw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace Script.UI
|
||||||
|
{
|
||||||
|
public class DrawPanel : PanelBase
|
||||||
|
{
|
||||||
|
public Text txt_TeamContent;
|
||||||
|
public Text txt_CultureContent;
|
||||||
|
public Button btn_Start;
|
||||||
|
public Button btn_Stop;
|
||||||
|
public Button btn_Close;
|
||||||
|
|
||||||
|
private bool isRoll;
|
||||||
|
private int index;
|
||||||
|
|
||||||
|
public override void Init()
|
||||||
|
{
|
||||||
|
base.Init();
|
||||||
|
btn_Start.onClick.AddListener(ClickStart);
|
||||||
|
btn_Stop.onClick.AddListener(ClickStop);
|
||||||
|
btn_Close.onClick.AddListener(ClickClose);
|
||||||
|
btn_Start.gameObject.SetActive(true);
|
||||||
|
btn_Stop.gameObject.SetActive(false);
|
||||||
|
btn_Close.gameObject.SetActive(false);
|
||||||
|
index = 0;
|
||||||
|
isRoll = false;
|
||||||
|
|
||||||
|
txt_TeamContent.text = "";
|
||||||
|
txt_CultureContent.text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
base.Dispose();
|
||||||
|
btn_Start.onClick.RemoveListener(ClickStart);
|
||||||
|
btn_Stop.onClick.RemoveListener(ClickStop);
|
||||||
|
btn_Close.onClick.RemoveListener(ClickClose);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Open()
|
||||||
|
{
|
||||||
|
base.Open();
|
||||||
|
btn_Start.gameObject.SetActive(true);
|
||||||
|
btn_Stop.gameObject.SetActive(false);
|
||||||
|
btn_Close.gameObject.SetActive(false);
|
||||||
|
index = 0;
|
||||||
|
isRoll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClickStart()
|
||||||
|
{
|
||||||
|
isRoll = true;
|
||||||
|
StartCoroutine(Roll());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClickClose()
|
||||||
|
{
|
||||||
|
SaveExcelData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClickStop()
|
||||||
|
{
|
||||||
|
isRoll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator Roll()
|
||||||
|
{
|
||||||
|
while (isRoll)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(0.02f);
|
||||||
|
var teamData = ExcelManager.Instance.GetTeamRandomInfo;
|
||||||
|
txt_TeamContent.text = teamData.teamName;
|
||||||
|
var cultureData = ExcelManager.Instance.GetCultureRandomInfo;
|
||||||
|
txt_CultureContent.text = cultureData.cultureName;
|
||||||
|
}
|
||||||
|
|
||||||
|
var teamData1 = ExcelManager.Instance.GetTeamRandomInfo;
|
||||||
|
txt_TeamContent.text = teamData1.teamName;
|
||||||
|
var cultureData1 = ExcelManager.Instance.GetCultureRandomInfo;
|
||||||
|
txt_CultureContent.text = cultureData1.cultureName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveExcelData()
|
||||||
|
{
|
||||||
|
SaveExcelData.SaveExcelDataInfo dataInfo = new SaveExcelData.SaveExcelDataInfo(new string[4]);
|
||||||
|
dataInfo.strings = new[] { "", "", txt_TeamContent.text, txt_CultureContent.text };
|
||||||
|
ExcelManager.Instance.SaveAndExpIndex(dataInfo, index);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dc26530f038642ae90a41ad53dc5786a
|
||||||
|
timeCreated: 1703508007
|
|
@ -4,8 +4,9 @@
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Home,
|
Home,
|
||||||
Team,
|
Team, // 弃用
|
||||||
Cultrue,
|
Cultrue, // 弃用
|
||||||
Finish
|
Finish,
|
||||||
|
Draw
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue