62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class IdeaPanel : BasePanel
|
|||
|
{
|
|||
|
//<2F>ر<EFBFBD>
|
|||
|
public Button btnClose;
|
|||
|
//<2F>ύ
|
|||
|
public Button btnSubmit;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public InputField inputIdea;
|
|||
|
|
|||
|
//ToggleGroup <20><><EFBFBD><EFBFBD>
|
|||
|
public ToggleGroup toggleGroup;
|
|||
|
|
|||
|
public override void Init()
|
|||
|
{
|
|||
|
btnClose.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
UIManager.Instance.HidePanel<IdeaPanel>();
|
|||
|
});
|
|||
|
btnSubmit.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (inputIdea!=null)
|
|||
|
{
|
|||
|
SendIdea();
|
|||
|
}
|
|||
|
|
|||
|
inputIdea.text = null;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
private void SendIdea()
|
|||
|
{
|
|||
|
IdeaMsg idea = new IdeaMsg();
|
|||
|
idea.openId = GameDataMgr.Instance.player.openId;
|
|||
|
idea.username = GameDataMgr.Instance.player.username;
|
|||
|
idea.ideaContent = inputIdea.text;
|
|||
|
GetText(idea);
|
|||
|
if (idea.ideaContent!=""&&idea.ideaType!=null)
|
|||
|
{
|
|||
|
StartCoroutine(NetMgr.Instance.IdeaPost(idea));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GetText(IdeaMsg idea)
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD> ToggleGroup <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Toggle
|
|||
|
foreach (Toggle toggle in toggleGroup.GetComponentsInChildren<Toggle>())
|
|||
|
{
|
|||
|
if (toggle.isOn)
|
|||
|
{
|
|||
|
idea.ideaType = toggle.GetComponentInChildren<Text>().text;
|
|||
|
return; // ֻ<><D6BB>Ҫ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB>ѡ<EFBFBD>е<EFBFBD> Toggle <20><><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|