|
@@ -29,7 +29,6 @@ namespace GFGGame
|
|
|
packageName = UI_LeagueAnsweringUI.PACKAGE_NAME;
|
|
|
_ui = UI_LeagueAnsweringUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
- // this.modal = true;
|
|
|
isfullScreen = true;
|
|
|
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing2");
|
|
@@ -53,15 +52,12 @@ namespace GFGGame
|
|
|
EventAgent.AddEventListener(ConstMessage.LEAGUE_ANSWER_RESULT_CHANGE, UpdateResult);
|
|
|
EventAgent.AddEventListener(ConstMessage.LEAGUE_ANSWER_RESULT_CHANGE, UpdateJoinList);
|
|
|
EventAgent.AddEventListener(ConstMessage.LEAGUE_ANSWER_MEMBER_CHANGE, UpdateJoinList);
|
|
|
- // EventAgent.AddEventListener(ConstMessage.LEAGUE_NUMBERIC_CHANGE, UpdateQuestionState);
|
|
|
EventAgent.AddEventListener(ConstMessage.NOTICE_CHAT_MESSAGE, UpdateChatList);
|
|
|
}
|
|
|
protected override async void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
_dataManager = LeagueDataManager.Instance;
|
|
|
- // _ui.m_listChat.numItems = ChatDataManager.Instance.GetChatDatas(ChatType.LeagueQuestion).Count;
|
|
|
- // _ui.m_listChat.scrollPane.ScrollBottom();
|
|
|
UpdateQuestionState();
|
|
|
UpdateChatList();
|
|
|
bool result = await LeagueSproxy.ReqJoinAnswer();
|
|
@@ -89,13 +85,21 @@ namespace GFGGame
|
|
|
|
|
|
private void OnBtnBackClick()
|
|
|
{
|
|
|
- AlertUI.Show("退出活动会损失奖励哦,是否仍要退出?")
|
|
|
- .SetLeftButton(true, "否")
|
|
|
- .SetRightButton(true, "是", (object data) =>
|
|
|
+ if (_dataManager.LastAnswerRoleData.LastQuestionResult == LastQuestionResult.Ending)
|
|
|
{
|
|
|
LeagueSproxy.ReqQuitAnswer().Coroutine();
|
|
|
ViewManager.GoBackFrom(typeof(LeagueAnsweringView).FullName);
|
|
|
- });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AlertUI.Show("退出活动会损失奖励哦,是否仍要退出?")
|
|
|
+ .SetLeftButton(true, "否")
|
|
|
+ .SetRightButton(true, "是", (object data) =>
|
|
|
+ {
|
|
|
+ LeagueSproxy.ReqQuitAnswer().Coroutine();
|
|
|
+ ViewManager.GoBackFrom(typeof(LeagueAnsweringView).FullName);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
private void OnBtnRuleClick()
|
|
|
{
|
|
@@ -103,6 +107,11 @@ namespace GFGGame
|
|
|
}
|
|
|
private async void OnBtnSendClick()
|
|
|
{
|
|
|
+ if (string.IsNullOrEmpty(_ui.m_txtChat.text))
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("还没有输入想发送的内容哦");
|
|
|
+ return;
|
|
|
+ }
|
|
|
bool result = await ChatSProxy.ReqSendChatMsg(ChatType.LeagueQuestion, _ui.m_txtChat.text);
|
|
|
if (result)
|
|
|
{
|
|
@@ -148,7 +157,6 @@ namespace GFGGame
|
|
|
}
|
|
|
private void UpdateQuestion()
|
|
|
{
|
|
|
- // _ui.m_txtRightCount.text = string.Format("全员已答对{0}题", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount));
|
|
|
_ui.m_txtRightCount.SetVar("value", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount).ToString()).FlushVars(); ;
|
|
|
_ui.m_txtRightCount1.SetVar("value", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount).ToString()).FlushVars(); ;
|
|
|
_ui.m_ctrlQuestionState.selectedIndex = 0;
|
|
@@ -190,13 +198,13 @@ namespace GFGGame
|
|
|
}
|
|
|
private void UpdateResult()
|
|
|
{
|
|
|
+ _ui.m_ctrlResult.selectedIndex = _dataManager.LastAnswerRoleData.LastQuestionResult;
|
|
|
_ui.m_txtRightCount.text = string.Format("全员已答对{0}题", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount));
|
|
|
- // _ui.txtRightCount1.text = string.Format("全员已答对{0}题", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount));
|
|
|
_ui.m_txtRightCount.SetVar("value", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount).ToString()).FlushVars();
|
|
|
_ui.m_txtRightCount1.SetVar("value", _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionTrueCount).ToString()).FlushVars();
|
|
|
_ui.m_txtCdTime.SetVar("value", GlobalCfgArray.globalCfg.leagueQuestionNextTime.ToString()).FlushVars();
|
|
|
_ui.m_ctrlQuestionState.selectedIndex = 1;
|
|
|
- _ui.m_ctrlResult.selectedIndex = _dataManager.LastAnswerRoleData.LastQuestionResult;
|
|
|
+
|
|
|
if (_dataManager.LastAnswerRoleData.LastQuestionResult == LastQuestionResult.SomeBodyRight)
|
|
|
{
|
|
|
|
|
@@ -240,7 +248,6 @@ namespace GFGGame
|
|
|
Timers.inst.Remove(UpdateResultTime);
|
|
|
return;
|
|
|
}
|
|
|
- // _ui.m_txtTime.text = (endTime - curTime) / 1000 + "秒后开始下一题";
|
|
|
_ui.m_txtCdTime.SetVar("value", (((endTime - curTime) / 1000) + 1).ToString()).FlushVars();
|
|
|
|
|
|
}
|
|
@@ -264,7 +271,6 @@ namespace GFGGame
|
|
|
item.target.title = string.Format("{0}.{1}", data, cfg.answerArr[index]);
|
|
|
string myAnswer = _dataManager.LastAnswerRoleData.MyAnswer;
|
|
|
bool isAnswer = !string.IsNullOrEmpty(_dataManager.LastAnswerRoleData.MyAnswer) && _dataManager.LastAnswerRoleData.LastQuestionId == _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionId);
|
|
|
- // item.m_c1.selectedIndex= !isAnswer;
|
|
|
item.target.touchable = !isAnswer;
|
|
|
item.m_c1.selectedIndex = isAnswer && myAnswer == data.ToString() && myAnswer != cfg.answerCorrect.ToString() ? 0 : 1;
|
|
|
if (item.target.data == null)
|
|
@@ -278,20 +284,21 @@ namespace GFGGame
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|
|
|
string answer = obj.data.ToString();
|
|
|
- // ChatSProxy.ReqSendChatMsg(ChatType.LeagueQuestion, answer).Coroutine();
|
|
|
int questionId = (int)_dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionId);
|
|
|
LeagueQuestionCfg cfg = LeagueQuestionCfgArray.Instance.GetCfg(questionId);
|
|
|
bool result = await LeagueSproxy.ReqAnswerQuestion(questionId, answer);
|
|
|
- if (result
|
|
|
- // && _dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionId) == _dataManager.LastAnswerRoleData.LastQuestionId
|
|
|
- // && _dataManager.LastAnswerRoleData.MyAnswer != cfg.answerCorrect
|
|
|
- )
|
|
|
+ if (result)
|
|
|
{
|
|
|
_ui.m_listResult.numItems = cfg.answerArr.Length;
|
|
|
}
|
|
|
}
|
|
|
private async void OnFocuseOut()
|
|
|
{
|
|
|
+ if (string.IsNullOrEmpty(_ui.m_txtResult.text))
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("还没有输入答案哦");
|
|
|
+ return;
|
|
|
+ }
|
|
|
int questionId = (int)_dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionId);
|
|
|
bool result = await LeagueSproxy.ReqAnswerQuestion(questionId, _ui.m_txtResult.text);
|
|
|
if (result)
|