From 4fe9a0cb48accde9cbcc05c00a1f7cf118b2791f Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 26 五月 2025 17:37:57 +0800
Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建
---
Main/System/Tip/PopConfirmWin.cs.meta | 11
Main/System/Tip/ConfirmCancel.cs | 328 +++++++++++++++++++
Main/System/Tip/ScrollTip.cs | 115 ++++++
Main/System/Tip/ToggleConfirmWin.cs | 99 +++++
Main/System/Tip/ScrollTipWin.cs.meta | 11
Main/System/Login/LoginWin.cs | 78 ++++
Main/System/Tip/PopConfirmWin.cs | 89 +++++
Main/System/ClientVersion/RequestSecretWin.cs | 6
Main/System/Tip/ToggleConfirmWin.cs.meta | 11
Main/System/Tip/ConfirmCancel.cs.meta | 11
Main/System/Tip/ScrollTip.cs.meta | 11
Main/System/Tip/ScrollTipDetail.cs.meta | 11
Main/System/Tip/ScrollTipDetail.cs | 90 +++++
Main/System/Tip/ScrollTipWin.cs | 113 ++++++
Main/Manager/LoginManager.cs | 11
15 files changed, 983 insertions(+), 12 deletions(-)
diff --git a/Main/Manager/LoginManager.cs b/Main/Manager/LoginManager.cs
index 5b0286c..f8e52bc 100644
--- a/Main/Manager/LoginManager.cs
+++ b/Main/Manager/LoginManager.cs
@@ -123,12 +123,11 @@
isLogined = true;
if (Application.internetReachability == NetworkReachability.NotReachable)
{
- // TODO YYL
- // ConfirmCancel.ShowPopConfirm(
- // Language.Get("Mail101"),
- // Language.Get("L1116"),
- // () => { }
- // );
+ ConfirmCancel.ShowPopConfirm(
+ Language.Get("Mail101"),
+ Language.Get("L1116"),
+ () => { }
+ );
return;
}
diff --git a/Main/System/ClientVersion/RequestSecretWin.cs b/Main/System/ClientVersion/RequestSecretWin.cs
index 47af4ff..8fe9c0d 100644
--- a/Main/System/ClientVersion/RequestSecretWin.cs
+++ b/Main/System/ClientVersion/RequestSecretWin.cs
@@ -30,12 +30,10 @@
#endif
});
m_Fuwu.SetListener(()=> {
- // TODO YYL
- // WindowCenter.Instance.OpenFromLocal<GameAgeWarnWin>(1);
+ UIManager.Instance.OpenWindow<GameAgeWarnWin>().SetFunctionOrder(1);
});
m_Yinsi.SetListener(() => {
- // TODO YYL
- // WindowCenter.Instance.OpenFromLocal<GameAgeWarnWin>(2);
+ UIManager.Instance.OpenWindow<GameAgeWarnWin>().SetFunctionOrder(2);
});
}
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index 3874f92..95f1537 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/Main/System/Login/LoginWin.cs
@@ -4,6 +4,7 @@
using System.Diagnostics.Tracing;
using UnityEngine;
using UnityEngine.UI;
+using System.IO;
public class LoginWin : UIBase, ICanvasRaycastFilter
{
@@ -60,7 +61,7 @@
m_UserHelp.SetListener(OpenUserHelp);
}
- m_CleanCache.SetListener(ResourcesPath.Instance.CleanCache);
+ m_CleanCache.SetListener(CleanCache);
serverRead.SetListener(() => {
GameAgeWarnWin win = UIManager.Instance.OpenWindow<GameAgeWarnWin>();
@@ -231,7 +232,7 @@
if (!checkRead.isOn)
{
// TODO YYL
- // ConfirmCancel.ShowPopConfirm(Language.Get("agreementTitle"), Language.Get("agreementInfo"));
+ ConfirmCancel.ShowPopConfirm(Language.Get("agreementTitle"), Language.Get("agreementInfo"));
LocalSave.SetBool("tqsecretToggle", false); //鏂逛究娴嬭瘯
return;
}
@@ -348,4 +349,77 @@
}
}
+
+
+ public void CleanCache()
+ {
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
+ Language.Get("CleanCache2"), (bool isOk) =>
+ {
+ if (isOk)
+ {
+ try
+ {
+ // 鑾峰彇persistentDataPath涓嬬殑鎵�鏈夋枃浠跺拰鏂囦欢澶�
+ string[] files = Directory.GetFiles(ResourcesPath.Instance.ExternalStorePath);
+ string[] dirs = Directory.GetDirectories(ResourcesPath.Instance.ExternalStorePath);
+
+ // 鍒犻櫎鎵�鏈夋枃浠�
+ foreach (string file in files)
+ {
+ if (file.Contains("config"))
+ {
+ continue;
+ }
+ File.Delete(file);
+ }
+
+
+ // 閫掑綊鍒犻櫎鎵�鏈夋枃浠跺す
+ foreach (string dir in dirs)
+ {
+ if (dir.Contains("config"))
+ {
+ continue;
+ }
+ Directory.Delete(dir, true);
+ }
+
+ files = Directory.GetFiles(ResourcesPath.Instance.ExternalStorePath + "/config");
+ // foreach (string file in files)
+ // {
+ // bool isDelete = true;
+ // foreach (string filename in ConfigInitiator.builtinConfig)
+ // {
+ // if (file.Contains(filename))
+ // {
+ // isDelete = false;
+ // break;
+ // }
+ // }
+
+ // if (isDelete)
+ // File.Delete(file);
+ // }
+
+
+ }
+ catch (System.Exception e)
+ {
+ Debug.LogError("Failed to clean persistent data: " + e.Message);
+ }
+ finally
+ {
+ Clock.AlarmAfter(0.1f, () =>
+ {
+ Application.Quit();
+ });
+ Debug.Log("Persistent data cleaned.");
+ }
+
+ }
+ });
+
+
+ }
}
diff --git a/Main/System/Tip/ConfirmCancel.cs b/Main/System/Tip/ConfirmCancel.cs
new file mode 100644
index 0000000..2822c2c
--- /dev/null
+++ b/Main/System/Tip/ConfirmCancel.cs
@@ -0,0 +1,328 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+
+public class ConfirmCancel
+{
+ public static Action<bool> OnPopConfirmClickEvent;
+ public static Action<bool> OnPopConfirmClickExEvent;
+ public static Action OnPopSingleConfirmEvent;
+ public static string popConfirmTitle { get; private set; }
+ public static string popConfirmInfo { get; private set; }
+ public static bool IsSingleConfirm { get; private set; }
+ public static string OKName { get; private set; }
+ public static string CancelName { get; private set; }
+
+ //鍙栨秷/纭寮规
+ public static void ShowPopConfirm(string title, string info, Action<bool> func)
+ {
+ popConfirmTitle = title;
+ popConfirmInfo = info;
+ OnPopConfirmClickEvent = func;
+ OnPopSingleConfirmEvent = null;
+ IsSingleConfirm = false;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<PopConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<PopConfirmWin>();
+ }
+ }
+
+ //鍙栨秷/纭寮规 func1瀵瑰簲纭鎸夐挳鏃佽竟鐨勫彇娑堟寜閽� func2瀵瑰簲鍙充笂瑙掔殑鍦嗗舰鍙栨秷鎸夐挳
+ public static void ShowPopConfirmEx(string title, string info, Action<bool> func1, Action<bool> func2)
+ {
+ popConfirmTitle = title;
+ popConfirmInfo = info;
+ OnPopConfirmClickEvent = func1;
+ OnPopSingleConfirmEvent = null;
+ OnPopConfirmClickExEvent = func2;
+ IsSingleConfirm = false;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<PopConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<PopConfirmWin>();
+ }
+ }
+
+ //鍗曟寜閽‘璁ゆ
+ public static void ShowPopConfirm(string title, string info, Action func = null)
+ {
+ popConfirmTitle = title;
+ popConfirmInfo = info;
+ OnPopConfirmClickEvent = null;
+ OnPopSingleConfirmEvent = func;
+ IsSingleConfirm = true;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<PopConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<PopConfirmWin>();
+ }
+ }
+
+ //甯︿袱涓寜閽殑纭妗� 鍙敼鍙樻寜閽枃瀛�
+ public static void ShowPopConfirm(string title, string info, string okName, string cancelName, Action<bool> func)
+ {
+ popConfirmTitle = title;
+ popConfirmInfo = info;
+ OnPopConfirmClickEvent = func;
+ OnPopSingleConfirmEvent = null;
+ IsSingleConfirm = false;
+ OKName = okName;
+ CancelName = cancelName;
+ if (!UIManager.Instance.IsOpened<PopConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<PopConfirmWin>();
+ }
+ }
+
+ // //鍙敼鍙樼‘璁ゆ寜閽枃瀛楃殑鍗曟寜閽‘璁ゆ锛岋紙鍛藉悕涓庡鐣屾棤鍏筹級
+ // public static void ShowRealmPopConfirm(string title, string info, string okName, Action func = null)
+ // {
+ // popConfirmTitle = title;
+ // popConfirmInfo = info;
+ // OKName = okName;
+ // OnPopConfirmClickEvent = null;
+ // OnPopSingleConfirmEvent = func;
+ // IsSingleConfirm = true;
+ // if (!UIManager.Instance.IsOpened<RealmPopConfirmWin>())
+ // {
+ // UIManager.Instance.OpenWindow<RealmPopConfirmWin>();
+ // }
+ // }
+
+ // public static void ShowRuneTowerPopConfirm(string title, string info, Action<bool> func)
+ // {
+ // popConfirmTitle = title;
+ // popConfirmInfo = info;
+ // OnPopConfirmClickEvent = func;
+ // OnPopSingleConfirmEvent = null;
+ // IsSingleConfirm = false;
+ // UIManager.Instance.OpenWindow<RuneTowerConfirmWin>();
+ // }
+
+
+ // public static void CancelAuctionPopConfirm(string title, string info, Action<bool> func)
+ // {
+ // popConfirmTitle = title;
+ // popConfirmInfo = info;
+ // OnPopConfirmClickEvent = func;
+ // OnPopSingleConfirmEvent = null;
+ // IsSingleConfirm = false;
+ // UIManager.Instance.OpenWindow<CancelAuctionConfirmWin>();
+ // }
+
+ public static string generalTitle;
+ public static string generalContent;
+ public static string toggleContent { get; private set; }
+ public static bool toggleOpenState { get; private set; }
+ public static Action<bool, bool> OnToggleConfirmEvent;
+ public static Action<bool> OnToggleSingleConfirmEvent;
+ public static Action<bool, bool> OnToggleConfirmEventEx;
+ //甯oggle鐨勭‘璁ゅ拰鍙栨秷
+ public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool, bool> func, bool _toggle = false)
+ {
+ generalTitle = title;
+ generalContent = content;
+ toggleContent = toggleTxt;
+ OnToggleSingleConfirmEvent = null;
+ OnToggleConfirmEvent = func;
+ toggleOpenState = _toggle;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ }
+ }
+
+ //甯oggle鐨勫彧鏈夌‘璁ゆ寜閽�
+ public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool> func, bool _toggle = false)
+ {
+ generalTitle = title;
+ generalContent = content;
+ toggleContent = toggleTxt;
+ OnToggleConfirmEvent = null;
+ OnToggleSingleConfirmEvent = func;
+ toggleOpenState = _toggle;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ }
+ }
+
+ //甯oggle鐨勭‘璁ゅ拰鍙栨秷 鍙充笂瑙掑渾褰㈠叧闂寜閽篃鏈夊洖璋冨嚱鏁�
+ public static void ToggleConfirmCancelEx(string title, string content, string toggleTxt, Action<bool, bool> func, Action<bool, bool> func1, bool _toggle = false)
+ {
+ generalTitle = title;
+ generalContent = content;
+ toggleContent = toggleTxt;
+ OnToggleSingleConfirmEvent = null;
+ OnToggleConfirmEvent = func;
+ OnToggleConfirmEventEx = func1;
+ toggleOpenState = _toggle;
+ OKName = null;
+ CancelName = null;
+ if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ }
+ }
+
+ //甯oggle鐨勭‘瀹氬拰鍙栨秷鎸夐挳锛屼笖鍙互鏀瑰彉鎸夐挳鏂囧瓧
+ public static void ToggleConfirmCancel(string title, string content, string toggleTxt, string okName, string cancelName, Action<bool, bool> func, bool _toggle = false)
+ {
+ generalTitle = title;
+ generalContent = content;
+ toggleContent = toggleTxt;
+ OnToggleSingleConfirmEvent = null;
+ OnToggleConfirmEvent = func;
+ toggleOpenState = _toggle;
+ OKName = okName;
+ CancelName = cancelName;
+ if (!UIManager.Instance.IsOpened<ToggleConfirmWin>())
+ {
+ UIManager.Instance.OpenWindow<ToggleConfirmWin>();
+ }
+ }
+
+ //鏈鐧婚檰涓嶅啀鎻愮ず, toggle鐨勭‘璁ょ被鍨嬶紝鏂逛究澶栭儴璋冪敤
+ static Dictionary<int, bool> toggleCheckDict = new Dictionary<int, bool>();
+ public enum ToggleCheckType
+ {
+ Auction = 0, //鎷嶅崠琛�
+ }
+
+ public static void ToggleConfirmCancelByType(int type, string fullTip, Action func)
+ {
+ if (toggleCheckDict.ContainsKey(type) && toggleCheckDict[type])
+ {
+ func?.Invoke();
+ return;
+ }
+
+ ToggleConfirmCancel(Language.Get("Mail101"), fullTip,
+ Language.Get("ConfirmCancel102"), (bool isOk, bool isToggle) =>
+ {
+ if (isOk)
+ {
+ func?.Invoke();
+ toggleCheckDict[type] = isToggle;
+ }
+
+ });
+ }
+
+
+
+
+ // public static string iconTitle;
+ // public static string iconTopInfo;
+ // public static string iconBottomInfo;
+ // public static int iconItemId;
+ // public static int iconNeedCnt;
+ // public static int iconHaveCnt;
+ // public static string iconToggleText { get; private set; }
+ // public static Action<bool, bool> OnIconToggleConfirmAct;
+ // public static void IconConfirmCancel(string title, string topInfo, int id,
+ // int haveCnt, int needCnt, string bottomInfo, string toggleTxt, Action<bool, bool> func)
+ // {
+ // iconTitle = title;
+ // iconTopInfo = topInfo;
+ // iconBottomInfo = bottomInfo;
+ // iconItemId = id;
+ // iconHaveCnt = haveCnt;
+ // iconNeedCnt = needCnt;
+ // iconToggleText = toggleTxt;
+ // OnIconToggleConfirmAct = func;
+ // if (!UIManager.Instance.IsOpened<IconConfirmWin>())
+ // {
+ // UIManager.Instance.OpenWindow<IconConfirmWin>();
+ // }
+ // }
+
+
+ // public static Action<bool> OnFairyLeagueGuideEvent;
+ // public static void ShowFairyLeagueGuide(Action<bool> func = null)
+ // {
+ // OnFairyLeagueGuideEvent = func;
+ // if (!UIManager.Instance.IsOpened<FairyLeagueGuideSelectWin>())
+ // {
+ // UIManager.Instance.OpenWindow<FairyLeagueGuideSelectWin>();
+ // }
+ // }
+
+ // public static string generalItemTip;
+ // public static int generalItemId;
+ // public static int generalItemCnt;
+ // public static Action ItemConfirmEvent;
+ // public static void ShowItemConfirm(string info, int _itemId, int _itemCnt, Action func)
+ // {
+ // generalItemTip = info;
+ // generalItemId = _itemId;
+ // generalItemCnt = _itemCnt;
+ // ItemConfirmEvent = func;
+ // if (!UIManager.Instance.IsOpened<ItemConfirmWin>())
+ // {
+ // UIManager.Instance.OpenWindow<ItemConfirmWin>();
+ // }
+ // }
+
+ // public static List<Item> getItems { get; private set; }
+ // //澶氱墿鍝佺‘璁ゆ
+ // public static void ShowItemsConfirm(List<Item> items, string tiltle, string info, string btnText, Action func, int moneyCnt = 0, int type = 0)
+ // {
+ // getItems = items;
+ // generalTitle = tiltle;
+ // generalItemTip = info;
+ // ItemConfirmEvent = func;
+ // OKName = btnText;
+ // ItemConfirmEvent = func;
+ // moneyType = type;
+ // moneyNeedCount = moneyCnt;
+ // if (!UIManager.Instance.IsOpened<ItemsConfirmWin>())
+ // {
+ // UIManager.Instance.OpenWindow<ItemsConfirmWin>();
+ // }
+ // }
+
+
+
+ // public static string moneyTitle;
+ // public static string moneyTopInfo;
+ // public static string moneybtnOkText;
+ // public static int moneyType;
+ // public static int moneyNeedCount;
+ // public static ulong moneyHaveCount;
+ // public static string moneyToggleText { get; private set; }
+ // public static bool moneytoggleOpen { get; private set; }
+ // public static bool moneytoggleOpenState { get; private set; }
+
+ // public static Action<bool, bool> OnMoneyToggleConfirmAct;
+ // public static void MoneyIconToggleConfirm(string title, string topInfo,string okTxt, int type,
+ // int needCnt, ulong haveCnt, Action<bool, bool> func, bool toggleOpen = false, string toggleTxt = "", bool toggleOpenState = false)
+ // {
+ // moneyTitle = title;
+ // moneyTopInfo = topInfo;
+ // moneybtnOkText = okTxt;
+ // moneyType = type;
+ // moneyNeedCount = needCnt;
+ // moneyHaveCount = haveCnt;
+ // moneyToggleText = toggleTxt;
+ // moneytoggleOpen = toggleOpen;
+ // moneytoggleOpenState = toggleOpenState;
+ // OnMoneyToggleConfirmAct = func;
+ // if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>())
+ // {
+ // UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>();
+ // }
+ // }
+
+}
+
+
diff --git a/Main/System/Tip/ConfirmCancel.cs.meta b/Main/System/Tip/ConfirmCancel.cs.meta
new file mode 100644
index 0000000..c6a053e
--- /dev/null
+++ b/Main/System/Tip/ConfirmCancel.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9ccdf806f5095f74cb57bf85b53ac31c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Tip/PopConfirmWin.cs b/Main/System/Tip/PopConfirmWin.cs
new file mode 100644
index 0000000..ed1bae2
--- /dev/null
+++ b/Main/System/Tip/PopConfirmWin.cs
@@ -0,0 +1,89 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Wednesday, November 29, 2017
+//--------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class PopConfirmWin : UIBase
+{
+ [SerializeField] Button popConfirmBtn;
+ [SerializeField] Button popCancelBtn;
+ [SerializeField] RichText popConfirmInfo;
+ [SerializeField] Text popConfirmTitle;
+ [SerializeField] Button closeBtn;
+ protected override void InitComponent()
+ {
+ popConfirmBtn.onClick.AddListener(OnPopConfirmOkBtn);
+ popCancelBtn.onClick.AddListener(OnPopConfirmCancelBtn);
+ closeBtn.onClick.AddListener(OnPopConfirmCancelExBtn);
+ }
+
+ protected override void OnPreOpen()
+ {
+ popCancelBtn.SetActive(!ConfirmCancel.IsSingleConfirm);
+
+ popConfirmTitle.text = ConfirmCancel.popConfirmTitle;
+ popConfirmInfo.text = ConfirmCancel.popConfirmInfo;
+
+ if (string.IsNullOrEmpty(ConfirmCancel.OKName))
+ (popConfirmBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_OK");
+ else
+ (popConfirmBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.OKName;
+ if (string.IsNullOrEmpty(ConfirmCancel.CancelName))
+ (popCancelBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_Cancel");
+ else
+ (popCancelBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.CancelName;
+ }
+
+ protected override void OnOpen()
+ {
+ }
+
+ protected override void OnPreClose()
+ {
+ }
+
+ protected override void OnClose()
+ {
+ }
+
+
+
+ void OnPopConfirmOkBtn()
+ {
+ CloseWindow();
+ if (ConfirmCancel.OnPopConfirmClickEvent != null)
+ {
+ ConfirmCancel.OnPopConfirmClickEvent(true);
+ return;
+ }
+ if (ConfirmCancel.OnPopSingleConfirmEvent != null)
+ {
+ ConfirmCancel.OnPopSingleConfirmEvent();
+ }
+ }
+
+ void OnPopConfirmCancelBtn()
+ {
+ CloseWindow();
+ if (ConfirmCancel.OnPopConfirmClickEvent != null)
+ {
+ ConfirmCancel.OnPopConfirmClickEvent(false);
+ }
+ }
+ void OnPopConfirmCancelExBtn()
+ {
+ CloseWindow();
+ if (ConfirmCancel.OnPopConfirmClickExEvent != null)
+ {
+ ConfirmCancel.OnPopConfirmClickExEvent(false);
+ }
+ }
+}
+
+
diff --git a/Main/System/Tip/PopConfirmWin.cs.meta b/Main/System/Tip/PopConfirmWin.cs.meta
new file mode 100644
index 0000000..f6e0f8f
--- /dev/null
+++ b/Main/System/Tip/PopConfirmWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8220ab0c429b88e4dbe2f03096f01add
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Tip/ScrollTip.cs b/Main/System/Tip/ScrollTip.cs
new file mode 100644
index 0000000..b7cd12e
--- /dev/null
+++ b/Main/System/Tip/ScrollTip.cs
@@ -0,0 +1,115 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+ public class ScrollTip
+ {
+ public static List<SystemHintData> m_Hints = new List<SystemHintData>();
+ public static List<ScrollTipDetail> m_ActiveTips = new List<ScrollTipDetail>();
+
+ private static GameObjectPoolManager.GameObjectPool pool = null;
+
+ private static bool inited = false;
+
+ public static float tipMoveTime = 0.2f;
+
+ public static event Action OnTipReceiveEvent;
+
+
+ public static void ShowTip(string tip, ArrayList infoList = null, int _order = 0)
+ {
+ int range = Math.Min(m_Hints.Count, 10);
+ int findCnt = 0;
+ for (int i = 1; i <= range; i++)
+ {
+ if (m_Hints[m_Hints.Count - i].message == tip)
+ {
+ findCnt++;
+ if (findCnt == 3)
+ {
+ //鍒楄〃鍐呴噸澶嶆彁绀烘渶澶�3娆�
+ return;
+ }
+ }
+ }
+
+ m_Hints.Add(new SystemHintData()
+ {
+ message = tip,
+ extentionData = infoList == null ? infoList : new ArrayList(infoList),
+ appendTime = DateTime.Now,
+ order = _order
+ });
+
+ //m_Hints.Sort(SysNotifyMgr.Instance.Compare);
+
+ if (OnTipReceiveEvent != null)
+ {
+ OnTipReceiveEvent();
+ }
+
+ if (!UIManager.Instance.IsOpened<ScrollTipWin>())
+ {
+ UIManager.Instance.OpenWindow<ScrollTipWin>();
+ }
+ }
+
+ public static ScrollTipDetail Request()
+ {
+ ScrollTipDetail tip = null;
+ if (pool == null)
+ {
+ var _prefab = ResManager.Instance.LoadAsset<GameObject>("Prefab", "Tip");// UILoader.LoadPrefab("Tip");
+ pool = GameObjectPoolManager.Instance.RequestPool(_prefab);
+ }
+ if (pool != null)
+ {
+ tip = pool.Request().AddMissingComponent<ScrollTipDetail>();
+ }
+ return tip;
+ }
+
+ public static void Release(ScrollTipDetail tip, bool next = true)
+ {
+ if (m_ActiveTips.Contains(tip))
+ {
+ tip.presentState = ScrollTipState.None;
+ m_ActiveTips.Remove(tip);
+ }
+ if (tip.gameObject != null && pool != null)
+ {
+ pool.Release(tip.gameObject);
+ }
+ if (m_ActiveTips.Count > 0 && next)
+ {
+ m_ActiveTips[0].Play(ScrollTipState.Hide);
+ }
+ }
+
+ public static void ReleaseAll()
+ {
+ for (int i = 0; i < m_ActiveTips.Count; i++)
+ {
+ Release(m_ActiveTips[i]);
+ i--;
+ }
+ }
+
+ public static void OnTipComplete()
+ {
+ if (OnTipReceiveEvent != null) OnTipReceiveEvent();
+ }
+
+ public static void Close()
+ {
+ m_Hints.Clear();
+ }
+
+ public enum ScrollTipState
+ {
+ None,
+ Idle,
+ Move,
+ Hide
+ }
+ }
diff --git a/Main/System/Tip/ScrollTip.cs.meta b/Main/System/Tip/ScrollTip.cs.meta
new file mode 100644
index 0000000..e01b94f
--- /dev/null
+++ b/Main/System/Tip/ScrollTip.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3e70f36a739dcae499725882c3c41288
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Tip/ScrollTipDetail.cs b/Main/System/Tip/ScrollTipDetail.cs
new file mode 100644
index 0000000..2454b68
--- /dev/null
+++ b/Main/System/Tip/ScrollTipDetail.cs
@@ -0,0 +1,90 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+ [RequireComponent(typeof(CanvasGroup))]
+ public class ScrollTipDetail : MonoBehaviour
+ {
+
+ RichText text;
+
+ CanvasGroup canvasGroup;
+ [HideInInspector]
+ public ScrollTip.ScrollTipState presentState = ScrollTip.ScrollTipState.Idle;
+ private float m_Time = 0;
+ private Vector3 pos = Vector3.zero;
+
+ private float m_TipShowTime;
+ private float m_TipHideTime;
+ private float m_TipDistance;
+
+ private void Awake()
+ {
+ canvasGroup = GetComponent<CanvasGroup>();
+ text = transform.Find("Text").GetComponent<RichText>();
+ }
+
+ public void ShowTip(SystemHintData _hint)
+ {
+ text.SetExtenalData(_hint.extentionData);
+ text.text = _hint.message;
+ }
+
+ public void SetTipConfig(float _showTime,float _hideTime,float _dis)
+ {
+ m_TipShowTime = _showTime;
+ m_TipHideTime = _hideTime;
+ m_TipDistance = _dis;
+ }
+
+ public void Play(ScrollTip.ScrollTipState state)
+ {
+ m_Time = 0;
+ canvasGroup.alpha = 1;
+ pos = transform.localPosition;
+ presentState = state;
+ }
+
+ private void LateUpdate()
+ {
+ m_Time += Time.deltaTime;
+ switch (presentState) {
+ case ScrollTip.ScrollTipState.Idle: {
+ m_Time = Mathf.Min(m_Time, m_TipShowTime);
+ if (m_Time >= m_TipShowTime) {
+ m_Time = 0;
+ var index = ScrollTip.m_ActiveTips.IndexOf(this);
+ if (index == 0) {
+ presentState = ScrollTip.ScrollTipState.Hide;
+ }
+ else {
+ presentState = ScrollTip.ScrollTipState.None;
+ }
+ }
+ }
+ break;
+ case ScrollTip.ScrollTipState.Move: {
+ m_Time = Mathf.Min(m_Time, ScrollTip.tipMoveTime);
+ transform.localPosition = Vector3.Lerp(pos, pos.SetY(pos.y + m_TipDistance), m_Time / ScrollTip.tipMoveTime);
+ if (m_Time >= ScrollTip.tipMoveTime) {
+ m_Time = 0;
+ presentState = ScrollTip.ScrollTipState.Idle;
+ ScrollTip.OnTipComplete();
+ }
+ }
+ break;
+ case ScrollTip.ScrollTipState.Hide: {
+ m_Time = Mathf.Min(m_Time, m_TipHideTime);
+ canvasGroup.alpha = 1 - m_Time / m_TipHideTime;
+ if (m_Time >= m_TipHideTime) {
+ m_Time = 0;
+ presentState = ScrollTip.ScrollTipState.None;
+ ScrollTip.Release(this);
+ ScrollTip.OnTipComplete();
+ }
+ }
+ break;
+ }
+ }
+ }
\ No newline at end of file
diff --git a/Main/System/Tip/ScrollTipDetail.cs.meta b/Main/System/Tip/ScrollTipDetail.cs.meta
new file mode 100644
index 0000000..a1ee51c
--- /dev/null
+++ b/Main/System/Tip/ScrollTipDetail.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0555ed917b459d14bb49d0044bb02fea
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Tip/ScrollTipWin.cs b/Main/System/Tip/ScrollTipWin.cs
new file mode 100644
index 0000000..e99ffe1
--- /dev/null
+++ b/Main/System/Tip/ScrollTipWin.cs
@@ -0,0 +1,113 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Saturday, October 07, 2017
+//--------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class ScrollTipWin : UIBase
+{
+ [SerializeField] RectTransform content;
+ [SerializeField] RectTransform mask;
+
+ [SerializeField, Header("鏄剧ず鏉℃暟")]
+ int tipDisplayCnt = 3;
+ [SerializeField, Header("姣忔婊氬姩鐨勮窛绂�")]
+ float m_TipDistance = 50.0f;
+ [SerializeField, Header("鎻愮ず棰勫埗浣撻珮搴�")]
+ float m_TipHeight = 40.0f;
+ [SerializeField, Header("鏄剧ず鏃堕棿")]
+ float m_TipShowTime = 1.0f;
+ [SerializeField, Header("绉诲姩鏃堕棿")]
+ float m_TipMoveTime = 0.2f;
+ [SerializeField, Header("闅愯棌鏃堕棿")]
+ float m_TipHideTime = 0.5f;
+
+ protected override void InitComponent()
+ {
+
+ }
+
+ protected override void OnClose()
+ {
+
+ }
+
+ protected override void OnOpen()
+ {
+
+ }
+
+ protected override void OnPreClose()
+ {
+ ScrollTip.OnTipReceiveEvent -= OnTipReceiveEvent;
+ ScrollTip.ReleaseAll();
+ }
+
+ protected override void OnPreOpen()
+ {
+ ScrollTip.tipMoveTime = m_TipMoveTime;
+ ScrollTip.OnTipReceiveEvent += OnTipReceiveEvent;
+ mask.sizeDelta = mask.sizeDelta.SetY(tipDisplayCnt * m_TipHeight + (tipDisplayCnt - 1) * (m_TipDistance - m_TipHeight) + 10);
+ for (int i = 0; i < ScrollTip.m_Hints.Count; i++)
+ {
+ OnTipReceiveEvent();
+ }
+ }
+
+ private void OnTipReceiveEvent()
+ {
+ if (ScrollTip.m_Hints.Count > 0 && IsCanAdd())
+ {
+ if (ScrollTip.m_ActiveTips.Count >= tipDisplayCnt)
+ {
+ ScrollTip.Release(ScrollTip.m_ActiveTips[0], false);
+ }
+ if (ScrollTip.m_ActiveTips.Count >= tipDisplayCnt)
+ {
+ ScrollTip.tipMoveTime = Time.deltaTime;
+ }
+ else
+ {
+ ScrollTip.tipMoveTime = m_TipMoveTime;
+ }
+ for (int i = 0; i < ScrollTip.m_ActiveTips.Count; i++)
+ {
+ ScrollTip.m_ActiveTips[i].Play(ScrollTip.ScrollTipState.Move);
+ }
+ ScrollTipDetail tipDetail = ScrollTip.Request();
+ if (tipDetail != null)
+ {
+ tipDetail.SetTipConfig(m_TipShowTime, m_TipHideTime, m_TipDistance);
+ ScrollTip.m_ActiveTips.Add(tipDetail);
+ var rt = tipDetail.transform;
+ rt.SetParent(content.parent);
+ rt.localScale = Vector3.one;
+ rt.localPosition = content.localPosition;
+ var _hint = ScrollTip.m_Hints[0];
+ ScrollTip.m_Hints.RemoveAt(0);
+ tipDetail.ShowTip(_hint);
+ tipDetail.Play(ScrollTip.ScrollTipState.Idle);
+ }
+ }
+ }
+
+ private bool IsCanAdd()
+ {
+ for (int i = 0; i < ScrollTip.m_ActiveTips.Count; i++)
+ {
+ if (ScrollTip.m_ActiveTips[i].presentState == ScrollTip.ScrollTipState.Move)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+
+
diff --git a/Main/System/Tip/ScrollTipWin.cs.meta b/Main/System/Tip/ScrollTipWin.cs.meta
new file mode 100644
index 0000000..3ad201a
--- /dev/null
+++ b/Main/System/Tip/ScrollTipWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9d186d62731a33d4fb508206b5d33189
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Tip/ToggleConfirmWin.cs b/Main/System/Tip/ToggleConfirmWin.cs
new file mode 100644
index 0000000..679dde6
--- /dev/null
+++ b/Main/System/Tip/ToggleConfirmWin.cs
@@ -0,0 +1,99 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Saturday, December 02, 2017
+//--------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+
+public class ToggleConfirmWin : UIBase
+{
+ [SerializeField] Text m_Title;
+ [SerializeField] Text m_Content;
+ [SerializeField] Text m_ToggleTxt;
+ [SerializeField] Toggle m_Toggle;
+ [SerializeField] Button m_ConfirmBtn;
+ [SerializeField] Button m_CancelBtn;
+ [SerializeField] Button m_CloseBtn;
+
+ protected override void InitComponent()
+ {
+ m_ConfirmBtn.onClick.AddListener(OnConfirm);
+ m_CancelBtn.onClick.AddListener(OnCancel);
+ m_CloseBtn.onClick.AddListener(OnCancelEx);
+ }
+
+ protected override void OnPreOpen()
+ {
+ m_Title.text = ConfirmCancel.generalTitle;
+ m_Content.text = ConfirmCancel.generalContent;
+ m_ToggleTxt.text = ConfirmCancel.toggleContent;
+ m_Toggle.isOn = ConfirmCancel.toggleOpenState;
+
+ m_CancelBtn.SetActive(ConfirmCancel.OnToggleConfirmEvent != null);
+
+ if (string.IsNullOrEmpty(ConfirmCancel.OKName))
+ (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_OK");
+ else
+ (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.OKName;
+ if (string.IsNullOrEmpty(ConfirmCancel.CancelName))
+ (m_CancelBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_Cancel");
+ else
+ (m_CancelBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.CancelName;
+ }
+
+ protected override void OnOpen()
+ {
+ }
+
+ protected override void OnPreClose()
+ {
+ }
+
+ protected override void OnClose()
+ {
+ }
+ private void OnConfirm()
+ {
+ if (ConfirmCancel.OnToggleConfirmEvent != null)
+ {
+ ConfirmCancel.OnToggleConfirmEvent(true, m_Toggle.isOn);
+ }
+ else if (ConfirmCancel.OnToggleSingleConfirmEvent != null)
+ {
+ ConfirmCancel.OnToggleSingleConfirmEvent(m_Toggle.isOn);
+ }
+ CloseWindow();
+ }
+
+ private void OnCancel()
+ {
+ if (ConfirmCancel.OnToggleConfirmEvent != null)
+ {
+ ConfirmCancel.OnToggleConfirmEvent(false, m_Toggle.isOn);
+ }
+ else if (ConfirmCancel.OnToggleSingleConfirmEvent != null)
+ {
+ ConfirmCancel.OnToggleSingleConfirmEvent(m_Toggle.isOn);
+ }
+ CloseWindow();
+ }
+
+ private void OnCancelEx()
+ {
+ if (ConfirmCancel.OnToggleConfirmEventEx != null)
+ {
+ ConfirmCancel.OnToggleConfirmEventEx(false, m_Toggle.isOn);
+ }
+ CloseWindow();
+ }
+}
+
+
+
+
+
diff --git a/Main/System/Tip/ToggleConfirmWin.cs.meta b/Main/System/Tip/ToggleConfirmWin.cs.meta
new file mode 100644
index 0000000..f92f031
--- /dev/null
+++ b/Main/System/Tip/ToggleConfirmWin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 30f4031c9ebe0fa41aa1ffd0a88437b2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
Gitblit v1.8.0