ball 项目提交
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class PrivacyCtrl : BaseCtrl
|
||||
{
|
||||
public static PrivacyCtrl Instance { get; private set; }
|
||||
|
||||
private PrivacyModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33119cc76673ef04c93c6b8541ad9a8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class PrivacyModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7dfdb69313292dc4cb7b2cd1af68779e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,129 @@
|
||||
using SGModule.MarkdownKit;
|
||||
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using System.Globalization;
|
||||
|
||||
public class PrivacyUI : BaseUI
|
||||
{
|
||||
private PrivacyUICtrl ctrl;
|
||||
private PrivacyModel model;
|
||||
private FGUI.ZM_Privacy_24.com_privacy ui;
|
||||
|
||||
private string content;
|
||||
|
||||
private int isTerm;
|
||||
|
||||
public PrivacyUI(PrivacyUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.PrivacyUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Privacy_24";
|
||||
uiInfo.assetName = "com_privacy";
|
||||
uiInfo.layerType = UILayerType.Popup;
|
||||
uiInfo.isNeedOpenAnim = true;
|
||||
uiInfo.isNeedCloseAnim = true;
|
||||
uiInfo.isNeedUIMask = true;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
ui?.FadeOut();
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as FGUI.ZM_Privacy_24.com_privacy;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
isTerm = (int)args;
|
||||
|
||||
}
|
||||
|
||||
InitView();
|
||||
|
||||
ui.show.selectedIndex = isTerm != 2 ? 0 : 1;
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
ui?.FadeIn();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
bool BisTerm = isTerm < 2 && isTerm == 1 ;
|
||||
string title = BisTerm ? Language.GetContent("terms_service") : Language.GetContent("privacy");
|
||||
ui.title.text = isTerm == 2 ? "View Credits" : title;
|
||||
|
||||
var color = new Color(0.32f, 0.32f, 0.32f, 1f);
|
||||
MarkdownKit.Instance.ShowAsRichText(ui.text_list, BisTerm ? "user" : "privacy", color, (success, state) => {
|
||||
if (success) {
|
||||
Debug.Log("内容加载成功!当前状态:" + state);
|
||||
}
|
||||
else {
|
||||
Debug.LogError("内容加载失败!当前状态:" + state);
|
||||
}
|
||||
}, 44);
|
||||
|
||||
// LoadKit.Instance.LoadAsset<TextAsset>("TextAsset", BisTerm ? "Term" : "Privacy", (txt) =>
|
||||
// {
|
||||
// content = txt.text;
|
||||
//
|
||||
// var str = getstr(content, 16327);
|
||||
//
|
||||
// foreach (var t in str)
|
||||
// {
|
||||
// var aRichTextField = new GRichTextField();
|
||||
// aRichTextField.SetSize(GRoot.inst.width, 100);
|
||||
// aRichTextField.color = new Color(0.64f, 0.36f, 0.12f, 1f);
|
||||
// // aRichTextField.strokeColor = Color.black;
|
||||
// // aRichTextField.stroke = 1;
|
||||
// aRichTextField.textFormat.size = 44;
|
||||
// aRichTextField.autoSize = AutoSizeType.Height;
|
||||
// aRichTextField.AddRelation(GRoot.inst, RelationType.Width);
|
||||
// aRichTextField.text = t;
|
||||
// ui.text_list.AddChild(aRichTextField);
|
||||
// }
|
||||
//
|
||||
// ui.text_list.EnsureBoundsCorrect();
|
||||
// });
|
||||
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
}
|
||||
|
||||
public string[] getstr(string strs, int len)
|
||||
{
|
||||
double i = strs.Length;
|
||||
var array = new string[int.Parse(Math.Ceiling(i / len).ToString(CultureInfo.InvariantCulture))];
|
||||
for (var j = 0; j < array.Length; j++)
|
||||
{
|
||||
len = len <= strs.Length ? len : strs.Length;
|
||||
array[j] = strs[..len];
|
||||
strs = strs.Substring(len, strs.Length - len);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b3692c5a5b53a141bb168b2616166a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace BallKingdomCrush
|
||||
{
|
||||
public class PrivacyUICtrl : BaseUICtrl
|
||||
{
|
||||
private PrivacyUI ui;
|
||||
private PrivacyModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.PrivacyUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.PrivacyUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
|
||||
ui = null;
|
||||
}
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new PrivacyUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 895ffa70583bb1e4eb5e369eab12180b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user