fix:1、添加项目
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class FAQCtrl : BaseCtrl
|
||||
{
|
||||
public static FAQCtrl Instance { get; private set; }
|
||||
|
||||
private FAQModel model;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
//model = ModuleManager.Instance..GetModel(ModelConst.FAQModel) as FAQModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 141317c3032f4463da09be3c37e26ba8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class FAQModel : BaseModel
|
||||
{
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83f9eb69747b240dcb54855ff322ac86
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,240 @@
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using FGUI.P06_Hall;
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class FAQUI : BaseUI
|
||||
{
|
||||
private FAQUICtrl ctrl;
|
||||
private FAQModel model;
|
||||
private FGUI.P06_Hall.com_faq ui;
|
||||
|
||||
public FAQUI(FAQUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.FAQUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "P06_Hall";
|
||||
uiInfo.assetName = "com_faq";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.FAQModel) as FAQModel;
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.P06_Hall.com_faq;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
Debug.Log(JsonConvert.SerializeObject(ConfigSystem.GetConfig<FAQRuleModel>().dataList));
|
||||
Debug.Log(JsonConvert.SerializeObject(ConfigSystem.GetConfig<MessageBoardModel>().dataList));
|
||||
if (GameHelper.isRDExchangeMode())
|
||||
{
|
||||
rule_list = ConfigSystem.GetConfig<FAQRuleModel_1>().dataList;
|
||||
message_list = ConfigSystem.GetConfig<MessageBoardModel_1>().dataList;
|
||||
}
|
||||
else
|
||||
{
|
||||
rule_list = ConfigSystem.GetConfig<FAQRuleModel>().dataList;
|
||||
message_list = ConfigSystem.GetConfig<MessageBoardModel>().dataList;
|
||||
}
|
||||
|
||||
InitView();
|
||||
}
|
||||
private List<FAQRule> rule_list = ConfigSystem.GetConfig<FAQRuleModel>().dataList;
|
||||
private List<MessageBoard> message_list = ConfigSystem.GetConfig<MessageBoardModel>().dataList;
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
GameDispatcher.Instance.AddListener(GameMsg.faq_refresh, refreshList);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.faq_refresh, refreshList);
|
||||
}
|
||||
#endregion
|
||||
void refreshList(object a)
|
||||
{
|
||||
com_msg com_msg = (com_msg)UIPackage.CreateObject("P06_Hall", "com_msg");
|
||||
com_msg.text_msg.text = list_user_arr[list_user_arr.Count - 1] + ":" + list_content_arr[list_content_arr.Count - 1];
|
||||
|
||||
ui.list_msg.AddChild(com_msg);
|
||||
ui.list_msg.scrollPane.ScrollDown(500, false);
|
||||
}
|
||||
//初始化页面逻辑
|
||||
private void InitView()
|
||||
{
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
for (int i = 0; i < rule_list.Count; i++)
|
||||
{
|
||||
com_question question = (com_question)UIPackage.CreateObject("P06_Hall", "com_question");
|
||||
question.text_question.text = (i + 1) + "." + rule_list[i].Rule;
|
||||
if (question.text_question.width > 730) {
|
||||
question.text_question.autoSize = AutoSizeType.Shrink;
|
||||
question.text_question.width = 730;
|
||||
}
|
||||
ui.list_faq.AddChild(question);
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rule_list[i].Information1))
|
||||
{
|
||||
com_answer anster = (com_answer)UIPackage.CreateObject("P06_Hall", "com_answer");
|
||||
anster.text_answer.text = rule_list[i].Information1;
|
||||
ui.list_faq.AddChild(anster);
|
||||
}
|
||||
}
|
||||
else if (j == 1)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rule_list[i].Information2))
|
||||
{
|
||||
com_answer anster = (com_answer)UIPackage.CreateObject("P06_Hall", "com_answer");
|
||||
anster.text_answer.text = rule_list[i].Information2;
|
||||
ui.list_faq.AddChild(anster);
|
||||
}
|
||||
}
|
||||
else if (j == 2)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rule_list[i].Information3))
|
||||
{
|
||||
com_answer anster = (com_answer)UIPackage.CreateObject("P06_Hall", "com_answer");
|
||||
anster.text_answer.text = rule_list[i].Information3;
|
||||
ui.list_faq.AddChild(anster);
|
||||
}
|
||||
}
|
||||
else if (j == 3)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rule_list[i].Information4))
|
||||
{
|
||||
com_answer anster = (com_answer)UIPackage.CreateObject("P06_Hall", "com_answer");
|
||||
anster.text_answer.text = rule_list[i].Information4;
|
||||
ui.list_faq.AddChild(anster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (user_arr == null) //第一次显示
|
||||
{
|
||||
user_arr = message_list[0].user_name.Split(",");
|
||||
int user_index = PlayerPrefs.GetInt("user_index", 0);
|
||||
if (user_index + 10 >= user_arr.Length) user_index = 0;
|
||||
|
||||
|
||||
content_arr = message_list[0].message.Split(",");
|
||||
int faq_index = PlayerPrefs.GetInt("faq_index", 0);
|
||||
if (faq_index + 10 >= content_arr.Length) faq_index = 0;
|
||||
|
||||
|
||||
for (int i = user_index; i < user_index + 10; i++)
|
||||
{
|
||||
list_user_arr.Add(user_arr[i]);
|
||||
}
|
||||
for (int i = faq_index; i < faq_index + 10; i++)
|
||||
{
|
||||
list_content_arr.Add(content_arr[i]);
|
||||
}
|
||||
if (PlayerPrefs.GetInt("user_FAQindex", 0) < 10)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PlayerPrefs.GetString("user_FAQcontent", "")))
|
||||
{
|
||||
list_user_arr.Insert(10 - PlayerPrefs.GetInt("user_FAQindex", 0), PreferencesMgr.Instance.PlayerName);
|
||||
list_content_arr.Insert(10 - PlayerPrefs.GetInt("user_FAQindex", 0), PlayerPrefs.GetString("user_FAQcontent", ""));
|
||||
}
|
||||
}
|
||||
user_index += 10;
|
||||
faq_index += 10;
|
||||
PlayerPrefs.SetInt("user_index", user_index);
|
||||
PlayerPrefs.SetInt("faq_index", faq_index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < list_user_arr.Count; i++)
|
||||
{
|
||||
com_msg com_msg = (com_msg)UIPackage.CreateObject("P06_Hall", "com_msg");
|
||||
com_msg.text_msg.text = list_user_arr[i] + ":" + list_content_arr[i];
|
||||
ui.list_msg.AddChild(com_msg);
|
||||
}
|
||||
|
||||
ui.btn_send.SetClick(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(ui.input_msg.text)) {
|
||||
GameHelper.ShowTips("Please enter your message!");
|
||||
return;
|
||||
}
|
||||
Debug.Log(ui.input_msg.text);
|
||||
com_msg com_msg = (com_msg)UIPackage.CreateObject("P06_Hall", "com_msg");
|
||||
com_msg.text_msg.text = PreferencesMgr.Instance.PlayerName + ":" + ui.input_msg.text;
|
||||
list_user_arr.Add(PreferencesMgr.Instance.PlayerName);
|
||||
list_content_arr.Add(ui.input_msg.text);
|
||||
PlayerPrefs.SetInt("faq_time", (int)GameHelper.GetNowTime());
|
||||
PlayerPrefs.SetInt("user_FAQindex", 0);
|
||||
PlayerPrefs.SetString("user_FAQcontent", ui.input_msg.text);
|
||||
|
||||
ui.input_msg.text = "";
|
||||
ui.input_msg.promptText = "[color=#999999][size=40]Can only send once every hour[/size][/color]";
|
||||
ui.input_msg.touchable = false;
|
||||
ui.btn_send.SetClick(() => { });
|
||||
ui.list_msg.AddChild(com_msg);
|
||||
ui.list_msg.scrollPane.ScrollDown(500, false);
|
||||
|
||||
ui.btn_send.grayed = true;
|
||||
ui.input_bg.grayed = true;
|
||||
|
||||
});
|
||||
ui.list_msg.scrollPane.ScrollDown(1000, false);
|
||||
if (PlayerPrefs.GetInt("faq_time", 0) + 3600 > GameHelper.GetNowTime())
|
||||
{
|
||||
ui.input_msg.promptText = "[color=#999999][size=40]Can only send once every hour[/size][/color]";
|
||||
ui.input_msg.touchable = false;
|
||||
ui.btn_send.SetClick(() => { });
|
||||
ui.btn_send.grayed = true;
|
||||
ui.input_bg.grayed = true;
|
||||
}
|
||||
|
||||
ui.btn_contactus.SetClick(() => { GameHelper.OpenEmail(); });
|
||||
}
|
||||
|
||||
public static string[] user_arr;
|
||||
public static string[] content_arr;
|
||||
|
||||
public static List<string> list_user_arr = new List<string>();
|
||||
public static List<string> list_content_arr = new List<string>();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a9bee451b15a47eaaa4a44e93ccba93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,157 @@
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class FAQUICtrl : BaseUICtrl
|
||||
{
|
||||
private FAQUI ui;
|
||||
private FAQModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.FAQUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.FAQUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.FAQModel) as FAQModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new FAQUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
HallManager.Instance.UpdateSecondEvent += timeEvent;
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
private int time = 0;
|
||||
private int refresh_time=5;
|
||||
void timeEvent()
|
||||
{
|
||||
time++;
|
||||
// Debug.Log((int)GameHelper.GetNowTime());
|
||||
if (FAQUI.user_arr == null&&time > refresh_time) //第一次显示
|
||||
{
|
||||
List<MessageBoard> message_list = ConfigSystem.GetConfig<MessageBoardModel>().dataList;
|
||||
FAQUI.user_arr = message_list[0].user_name.Split(",");
|
||||
int user_index = PlayerPrefs.GetInt("user_index", 0);
|
||||
if (user_index + 10 >= FAQUI.user_arr.Length) user_index = 0;
|
||||
|
||||
|
||||
FAQUI.content_arr = message_list[0].message.Split(",");
|
||||
int faq_index = PlayerPrefs.GetInt("faq_index", 0);
|
||||
if (faq_index + 10 >= FAQUI.content_arr.Length) faq_index = 0;
|
||||
|
||||
|
||||
for (int i = user_index; i < user_index + 10; i++)
|
||||
{
|
||||
FAQUI.list_user_arr.Add(FAQUI.user_arr[i]);
|
||||
}
|
||||
for (int i = faq_index; i < faq_index + 10; i++)
|
||||
{
|
||||
FAQUI.list_content_arr.Add(FAQUI.content_arr[i]);
|
||||
}
|
||||
if (PlayerPrefs.GetInt("user_FAQindex", 0) < 10)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PlayerPrefs.GetString("user_FAQcontent", "")))
|
||||
{
|
||||
FAQUI.list_user_arr.Insert(10 - PlayerPrefs.GetInt("user_FAQindex", 0), PreferencesMgr.Instance.PlayerName);
|
||||
FAQUI.list_content_arr.Insert(10 - PlayerPrefs.GetInt("user_FAQindex", 0), PlayerPrefs.GetString("user_FAQcontent", ""));
|
||||
}
|
||||
}
|
||||
user_index += 10;
|
||||
faq_index += 10;
|
||||
PlayerPrefs.SetInt("user_index", user_index);
|
||||
PlayerPrefs.SetInt("faq_index", faq_index);
|
||||
}
|
||||
|
||||
if (time > refresh_time)
|
||||
{
|
||||
|
||||
time = 0;
|
||||
|
||||
int user_index = PlayerPrefs.GetInt("user_index", 0);
|
||||
// Debug.Log(user_index);
|
||||
// Debug.Log(FAQUI.user_arr);
|
||||
// Debug.Log(FAQUI.user_arr.Length);
|
||||
|
||||
if (user_index + 1 >= FAQUI.user_arr.Length) user_index = 0;
|
||||
|
||||
|
||||
|
||||
int faq_index = PlayerPrefs.GetInt("faq_index", 0);
|
||||
if (faq_index + 1 >= FAQUI.content_arr.Length) faq_index = 0;
|
||||
|
||||
|
||||
FAQUI.list_user_arr.Add(FAQUI.user_arr[user_index]);
|
||||
FAQUI.list_content_arr.Add(FAQUI.content_arr[faq_index]);
|
||||
if (FAQUI.list_user_arr.Count > 50)
|
||||
{
|
||||
FAQUI.list_user_arr.RemoveAt(0);
|
||||
}
|
||||
if (FAQUI.list_content_arr.Count > 50)
|
||||
{
|
||||
FAQUI.list_content_arr.RemoveAt(0);
|
||||
}
|
||||
user_index++;
|
||||
faq_index++;
|
||||
PlayerPrefs.SetInt("user_FAQindex", PlayerPrefs.GetInt("user_FAQindex", 0) + 1);
|
||||
PlayerPrefs.SetInt("user_index", user_index);
|
||||
PlayerPrefs.SetInt("faq_index", faq_index);
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.faq_refresh);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c21a94c563a4b4e1f8aebe5935b398c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user