From 109af8a8a6be90183cafd2cf2a4e59e445e9aedc Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 08 七月 2025 23:07:38 +0800
Subject: [PATCH] 0312 生成dotween的asmdef,提供给main使用,去除DOTweenExtensions
---
Main/Component/UI/Decorate/Tweens/ScaleTween.cs | 2
Main/Component/UI/Decorate/Tweens/PositionTween.cs | 2
Main/Component/UI/Decorate/Tweens/TweenEx.cs.meta | 0
Main/Main.asmdef | 7
Main/Component/UI/Core/TextEx.cs | 1
Main/System/Main/PlayerMainDate.cs.meta | 2
Main/System/Tip/PowerAddWin.cs | 366 ++++++++++++++++++++++++++++++++++++
Main/System/Tip/PowerAddWin.cs.meta | 5
Main/Component/UI/Decorate/Tweens/TweenEx.cs | 2
/dev/null | 45 ----
Main/System/Main/PlayerMainDate.cs | 117 +++++++++++
Main/Component/UI/Decorate/Tweens/RotationTween.cs | 2
Main/Main.cs | 1
13 files changed, 496 insertions(+), 56 deletions(-)
diff --git a/Main/Component/UI/Core/TextEx.cs b/Main/Component/UI/Core/TextEx.cs
index e1adbec..041c71a 100644
--- a/Main/Component/UI/Core/TextEx.cs
+++ b/Main/Component/UI/Core/TextEx.cs
@@ -1,5 +1,4 @@
锘縰sing UnityEngine.UI;
-using System.Text;
using UnityEngine;
public class TextEx : Text
diff --git a/Main/Component/UI/Decorate/Tweens/PositionTween.cs b/Main/Component/UI/Decorate/Tweens/PositionTween.cs
index 811eff9..8ccc0b0 100644
--- a/Main/Component/UI/Decorate/Tweens/PositionTween.cs
+++ b/Main/Component/UI/Decorate/Tweens/PositionTween.cs
@@ -1,7 +1,7 @@
锘縰sing UnityEngine;
using System.Collections;
- public class PositionTween : Tween
+ public class PositionTween : TweenEx
{
public override void SetStartState()
diff --git a/Main/Component/UI/Decorate/Tweens/RotationTween.cs b/Main/Component/UI/Decorate/Tweens/RotationTween.cs
index 719bbae..3360e8d 100644
--- a/Main/Component/UI/Decorate/Tweens/RotationTween.cs
+++ b/Main/Component/UI/Decorate/Tweens/RotationTween.cs
@@ -2,7 +2,7 @@
using System.Collections;
-public class RotationTween : Tween
+public class RotationTween : TweenEx
{
public override void SetStartState()
diff --git a/Main/Component/UI/Decorate/Tweens/ScaleTween.cs b/Main/Component/UI/Decorate/Tweens/ScaleTween.cs
index ae98577..7b51006 100644
--- a/Main/Component/UI/Decorate/Tweens/ScaleTween.cs
+++ b/Main/Component/UI/Decorate/Tweens/ScaleTween.cs
@@ -1,7 +1,7 @@
锘縰sing UnityEngine;
using System.Collections;
-public class ScaleTween : Tween
+public class ScaleTween : TweenEx
{
public override void SetStartState()
{
diff --git a/Main/Component/UI/Decorate/Tweens/Tween.cs b/Main/Component/UI/Decorate/Tweens/TweenEx.cs
similarity index 98%
rename from Main/Component/UI/Decorate/Tweens/Tween.cs
rename to Main/Component/UI/Decorate/Tweens/TweenEx.cs
index 4aa7a12..a973999 100644
--- a/Main/Component/UI/Decorate/Tweens/Tween.cs
+++ b/Main/Component/UI/Decorate/Tweens/TweenEx.cs
@@ -3,7 +3,7 @@
using System;
[RequireComponent(typeof(RectTransform))]
-public class Tween : MonoBehaviour
+public class TweenEx : MonoBehaviour
{
public TweenCurve curve;
public Vector3 from;
diff --git a/Main/Component/UI/Decorate/Tweens/Tween.cs.meta b/Main/Component/UI/Decorate/Tweens/TweenEx.cs.meta
similarity index 100%
rename from Main/Component/UI/Decorate/Tweens/Tween.cs.meta
rename to Main/Component/UI/Decorate/Tweens/TweenEx.cs.meta
diff --git a/Main/Extensions.meta b/Main/Extensions.meta
deleted file mode 100644
index b03a07b..0000000
--- a/Main/Extensions.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: c8b5029bcc3e1ae4f8ef4fe0786d47a7
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Main/Extensions/DOTweenExtensions.cs b/Main/Extensions/DOTweenExtensions.cs
deleted file mode 100644
index e759c48..0000000
--- a/Main/Extensions/DOTweenExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-using DG.Tweening;
-
-/// <summary>
-/// DOTween 鎵╁睍鏂规硶锛屼负涓嶅悓缁勪欢鎻愪緵鍔ㄧ敾鍔熻兘
-/// </summary>
-public static class DOTweenExtensions
-{
- /// <summary>
- /// 涓� CanvasGroup 鎻愪緵娣″叆娣″嚭鍔ㄧ敾
- /// </summary>
- /// <param name="target">鐩爣 CanvasGroup</param>
- /// <param name="endValue">鐩爣閫忔槑搴﹀�� (0-1)</param>
- /// <param name="duration">鍔ㄧ敾鎸佺画鏃堕棿</param>
- /// <returns>Tweener 瀹炰緥</returns>
- public static Tweener DOFade(this CanvasGroup target, float endValue, float duration)
- {
- return DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration);
- }
-
- /// <summary>
- /// 涓� RectTransform 鎻愪緵绉诲姩鍔ㄧ敾
- /// </summary>
- /// <param name="target">鐩爣 RectTransform</param>
- /// <param name="endValue">鐩爣浣嶇疆</param>
- /// <param name="duration">鍔ㄧ敾鎸佺画鏃堕棿</param>
- /// <returns>Tweener 瀹炰緥</returns>
- public static Tweener DOAnchorPos(this RectTransform target, Vector2 endValue, float duration)
- {
- return DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration);
- }
-
- /// <summary>
- /// 涓� Transform 鎻愪緵缂╂斁鍔ㄧ敾
- /// </summary>
- /// <param name="target">鐩爣 Transform</param>
- /// <param name="endValue">鐩爣缂╂斁鍊�</param>
- /// <param name="duration">鍔ㄧ敾鎸佺画鏃堕棿</param>
- /// <returns>Tweener 瀹炰緥</returns>
- public static Tweener DOScale(this Transform target, Vector3 endValue, float duration)
- {
- return DOTween.To(() => target.localScale, x => target.localScale = x, endValue, duration);
- }
-}
\ No newline at end of file
diff --git a/Main/Main.asmdef b/Main/Main.asmdef
index a5d805b..2832f27 100644
--- a/Main/Main.asmdef
+++ b/Main/Main.asmdef
@@ -5,11 +5,12 @@
"GUID:3ffa07c58a98b0445a7a34376b165fd1",
"GUID:4129704b5a1a13841ba16f230bf24a57",
"GUID:f51ebe6a0ceec4240a699833d6309b23",
- "GUID:e34a5702dd353724aa315fb8011f08c3",
- "GUID:4d1926c9df5b052469a1c63448b7609a",
"GUID:68765d262e2128e4ab49c983f3411946",
"GUID:173464ddf4cdb6640a4dfa8a9281ad69",
- "GUID:72d1fea872bd7a449bf3818f2b0a6708"
+ "GUID:72d1fea872bd7a449bf3818f2b0a6708",
+ "GUID:05d41852e29aa5141a64e3d2d5339981",
+ "GUID:9ad05b610be6c974590152128a8b5b6e",
+ "GUID:d51b17ee17bf72443860693b4f9c20af"
],
"includePlatforms": [],
"excludePlatforms": [],
diff --git a/Main/Main.cs b/Main/Main.cs
index 00311d5..8399ec0 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -69,6 +69,7 @@
managers.Add(ChatBubbleManager.Instance);
managers.Add(OfficialRankManager.Instance);
managers.Add(RankModel.Instance);
+ managers.Add(PlayerMainDate.Instance);
foreach (var manager in managers)
{
diff --git a/Main/System/Main/PlayerMainDate.cs b/Main/System/Main/PlayerMainDate.cs
new file mode 100644
index 0000000..2efdb1c
--- /dev/null
+++ b/Main/System/Main/PlayerMainDate.cs
@@ -0,0 +1,117 @@
+锘縰sing UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+
+using System.Collections.Generic;
+using System;
+
+//鐢ㄤ簬璁板綍涓荤晫闈㈢殑涓�浜涗俊鎭�
+
+public class PlayerMainDate : GameSystemManager<PlayerMainDate>
+{
+ public event Action AddPowerEvent;
+
+
+ //-------鐢ㄤ簬姣忓垎閽熺粡楠岀殑鑾峰彇
+ public delegate void OnExperience(int _source, int _ExpPoint, int _Exp);//锛�1.鍗曚綅缁忛獙浜跨偣锛�2.缁忛獙鍗曚綅鐐癸級
+ public static event OnExperience Event_Experience;
+
+ //--------------------鐢ㄤ簬鎴樻枟鍔涙粴鍔�
+
+ public long prowNum = 0;
+ public long prowNumChange = 0;
+ public bool isAdd = true;//涓簍rue澧炲姞 涓篺alse鍑忓皯
+ private bool prowBool = true;
+
+ public event Func<bool> customDisplayPower;
+
+ public override void Init()
+ {
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
+ }
+
+
+ public override void Release()
+ {
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
+ }
+
+
+
+ public void OnBeforePlayerDataInitialize()
+ {
+ prowNum = 0;
+ prowNumChange = 0;
+ prowBool = true;
+
+ }
+
+
+ public void PowerAdd(ulong power)
+ {
+ if (prowBool)
+ {
+ prowNum = (long)power;
+ prowBool = false;
+ }
+ else
+ {
+ if ((long)power > prowNum)
+ {
+ prowNumChange = (long)power - prowNum;
+ prowNum = (long)power;
+ isAdd = true;
+ if (customDisplayPower != null && customDisplayPower())
+ {
+ return;
+ }
+ if (UIManager.Instance.IsOpened<PowerAddWin>())
+ {
+ AddPowerEvent?.Invoke();
+ return;
+ }
+ UIManager.Instance.OpenWindow<PowerAddWin>();
+ }
+ else if ((long)power < prowNum)
+ {
+ prowNumChange = prowNum - (long)power;
+ prowNum = (long)power;
+ isAdd = false;
+ if (customDisplayPower != null && customDisplayPower())
+ {
+ return;
+ }
+ if (UIManager.Instance.IsOpened<PowerAddWin>())
+ {
+ AddPowerEvent?.Invoke();
+ return;
+ }
+ UIManager.Instance.OpenWindow<PowerAddWin>();
+ }
+ else
+ {
+ prowNum = (long)power;
+ }
+ }
+ }
+
+ public void CustomPowerUp(ulong nowPower ,ulong addPower)
+ {
+ prowNum = (long)nowPower;
+ prowNumChange = (long)addPower;
+ isAdd = true;
+ if (UIManager.Instance.IsOpened<PowerAddWin>())
+ {
+ AddPowerEvent?.Invoke();
+ return;
+ }
+ UIManager.Instance.OpenWindow<PowerAddWin>();
+ }
+
+
+}
+
+
+
+
+
diff --git a/Main/Extensions/DOTweenExtensions.cs.meta b/Main/System/Main/PlayerMainDate.cs.meta
similarity index 83%
rename from Main/Extensions/DOTweenExtensions.cs.meta
rename to Main/System/Main/PlayerMainDate.cs.meta
index e236516..e5c270b 100644
--- a/Main/Extensions/DOTweenExtensions.cs.meta
+++ b/Main/System/Main/PlayerMainDate.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 0e89b51ad990b594da7083af980fc740
+guid: ddd288094bc2f444ca741a428800c094
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Main/System/Tip/PowerAddWin.cs b/Main/System/Tip/PowerAddWin.cs
new file mode 100644
index 0000000..3b046a6
--- /dev/null
+++ b/Main/System/Tip/PowerAddWin.cs
@@ -0,0 +1,366 @@
+锘縰sing DG.Tweening;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using UnityEngine;
+
+//鎴樻枟鍔涘鍔�
+public class PowerAddWin : UIBase
+{
+ [SerializeField] TextEx txtBase; //鎻愬崌鎴栭檷浣庡墠鐨勬垬鏂楀姏
+ [SerializeField] TextEx txtChange; //鎴樻枟鍔涘彉鍖栦簡澶氬皯
+ [SerializeField] ImageEx imgArrow; //绠ご
+ [SerializeField] Transform transZhanLi; //鎴樺姏鏁翠綋妗�
+ [SerializeField] Transform transZhanLiNumAll; //鎴樺姏鎵�鏈夊彉鍖栭儴鍒�
+ [SerializeField] RectTransform transChange; //绠ご鍜屽彉鍖栨暟瀛楁暣浣撴
+ string uiFrameKey = "zhanli_dt";
+ [SerializeField] UIFrame uiFrame;
+ [SerializeField] List<PowerUpPosition> powerUpPositions;
+
+ [Header("娣″叆鍙樺ぇ")]
+ [SerializeField] Vector3 startVector; //璧峰澶у皬
+
+ [SerializeField] float fadeInToBigDuration; //娣″叆鍙樺ぇ鍔ㄧ敾瀹屾垚鏃堕棿
+ [SerializeField] Ease fadeInToBigEaseType;
+ [SerializeField] Vector3 fadeInToBigVector; //娣″叆鍙樺ぇ鐩爣澶у皬
+
+ [Header("娣″叆鍙樺皬")]
+ [SerializeField] Vector3 fadeInToSmallVector; //娣″叆鍙樺皬鐩爣澶у皬
+
+ [SerializeField] float fadeInToSmallDuration; //娣″叆鍙樺皬鍔ㄧ敾瀹屾垚鏃堕棿
+ [SerializeField] Ease fadeInToSmallEaseType;
+
+ [Header("娣″叆鍚庣Щ鍔ㄥ紑濮嬪墠绛夊緟鏃堕棿/s")]
+ [SerializeField] float moveStartWaitTime;
+
+ [Header("鍙樺寲鍊肩Щ鍔�")]
+ [SerializeField] float moveDuration; //鍙樺寲鍊肩Щ鍔ㄥ姩鐢诲畬鎴愭椂闂�
+
+ [SerializeField] Ease moveEaseType;
+
+ [Header("鍙樺寲鍊奸�忔槑搴﹂檷鍒�0")]
+ [SerializeField] float textFadeDuration; //鍙樺寲鍊奸�忔槑搴﹂檷鍒�0鐨勬椂闂�
+
+ [SerializeField] Ease textFadeEaseType;
+
+ [Header("鏁板瓧婊氬姩")]
+ [SerializeField] float rollDuration; //鏁板瓧婊氬姩鍔ㄧ敾瀹屾垚鏃堕棿
+
+ [SerializeField] float rollCount; //鏁板瓧婊氬姩娆℃暟
+ [SerializeField] Ease rollEaseType;
+
+ [Header("绉诲姩缁撴潫鍚庢贰鍑哄紑濮嬪墠绛夊緟鏃堕棿/s")]
+ [SerializeField] float moveEndWaitTime;
+
+ [Header("娣″嚭鍙樺ぇ")]
+ [SerializeField] Vector3 fadeOutToBigVector; //娣″嚭鍙樺ぇ鐩爣澶у皬
+
+ [SerializeField] float fadeOutToBigDuration; //娣″嚭鍙樺ぇ鍔ㄧ敾瀹屾垚鏃堕棿
+ [SerializeField] Ease fadeOutToBigEaseType;
+
+ [Header("娣″嚭鍙樺皬")]
+ [SerializeField] float fadeOutToSmallDuration; //娣″嚭鍙樺皬鍔ㄧ敾瀹屾垚鏃堕棿
+
+ [SerializeField] Ease fadeOutToSmallEaseType;
+
+ [Header("鎴樺姏鏁板瓧浣嶇疆璁$畻鐩稿叧")]
+ [SerializeField] float txtBaseMultiple; //鍓嶇疆鐨勬垬鍔涙暟瀛楀瓧姣嶈窛绂诲�嶆暟
+
+ [SerializeField] float txtChangeMultiple; //鍚庣疆鐨勬垬鍔涙暟瀛楀瓧姣嶈窛绂诲�嶆暟
+ [SerializeField] int baseFontWidth; //鍓嶇疆鐨勬垬鍔涙暟瀛楀瓧姣嶄竴涓澶�
+ [SerializeField] int changeFontWidth; //鍚庣疆鐨勬垬鍔涙暟瀛楀瓧姣嶄竴涓澶�
+ [SerializeField] float baseAndChangeInterval; //鍓嶇疆鍜屽悗缃殑鎴樺姏鏁板瓧涓棿鐨勯棿闅斿ぇ灏�
+ [SerializeField] float changeAndArrowInterval; //鍚庣疆鐨勬垬鍔涙暟瀛楀拰绠ご涔嬮棿鐨勯棿闅斿ぇ灏�
+ [SerializeField] float transChangeY; //Change缁勪欢鐨刌鍊�
+ [SerializeField] float intArrowAddInterval; //澧炲姞鎴栧噺灏戝�兼槸鏁存暟鏃�,鍚庣疆鐨勬垬鍔涙暟瀛楀拰绠ご涔嬮棿鐨勯棿闅斿鍔犲灏�
+ private float fadeInEndTime; // 鎾畬娣″叆鍔ㄧ敾鍚庣殑鏃堕棿
+ private float moveEndTime; // 鎾畬绉诲姩鍔ㄧ敾鍚庣殑鏃堕棿
+ long basePower;
+ long nowPower;
+ long changePower;
+ bool isAdd;
+
+ private enum AnimeState
+ {
+ FadeIn,
+ WaitMove,
+ Move,
+ WaitFadeOut,
+ FadeOut,
+ }
+
+ AnimeState nowState;
+
+ #region Built-in
+
+
+ protected override void OnPreOpen()
+ {
+ PlayerMainDate.Instance.AddPowerEvent += ResetToWaitMove;
+ ResetToFadeIn();
+ }
+
+
+
+ protected override void OnPreClose()
+ {
+ PlayerMainDate.Instance.AddPowerEvent -= ResetToWaitMove;
+ }
+
+
+
+ #endregion
+
+ Sequence sequence;
+ Sequence textChangeSequence;
+ Sequence fadeOutSequence;
+
+ protected void LateUpdate()
+ {
+ if (nowState == AnimeState.WaitMove)
+ {
+ if (Time.time - fadeInEndTime > moveStartWaitTime)
+ {
+ nowState = AnimeState.Move;
+
+ sequence = DOTween.Sequence();
+ sequence.Join(transChange.DOMove(new Vector3(txtBase.rectTransform.position.x, transChange.position.y, transChange.position.z) , moveDuration).SetEase(moveEaseType));
+ sequence.Join(txtChange.DOFade(0f, textFadeDuration).SetEase(textFadeEaseType));
+ sequence.Join(imgArrow.DOFade(0f, textFadeDuration).SetEase(textFadeEaseType));
+
+ textChangeSequence = DOTween.Sequence();
+ float rollTime = rollDuration / rollCount;
+ for (int i = 0; i < rollCount + 1; i++)
+ {
+ long changeValue = changePower / (int)rollCount * (i + 1);
+ long nowValue;
+ if (i == rollCount)
+ {
+ nowValue = nowPower;
+ sequence.Append(txtBase.DOText(DisplayBasePowerNum(nowValue), rollTime).SetEase(rollEaseType).OnComplete(() => { SetInitPosition(nowValue, changePower, isAdd); }));
+ }
+ else
+ {
+ if (isAdd)
+ {
+ nowValue = basePower + changeValue;
+ sequence.Append(txtBase.DOText(DisplayBasePowerNum(nowValue), rollTime).SetEase(rollEaseType).OnComplete(() => { SetInitPosition(nowValue, changePower, isAdd); }));
+ }
+ else
+ {
+ nowValue = basePower - changeValue;
+ sequence.Append(txtBase.DOText(DisplayBasePowerNum(nowValue), rollTime).SetEase(rollEaseType).OnComplete(() => { SetInitPosition(nowValue, changePower, isAdd); }));
+ }
+ }
+#if UNITY_EDITOR
+ Debug.Log($"count {i} changeValue {changeValue} nowValue {nowValue} isAdd {isAdd} basePower {basePower} changePower {changePower} nowPower {nowPower} rollTime {rollTime}");
+#endif
+ }
+ sequence.Join(textChangeSequence);
+
+ sequence.OnComplete(() =>
+ {
+ moveEndTime = Time.time;
+ nowState = AnimeState.WaitFadeOut;
+ });
+ }
+ }
+ else if (nowState == AnimeState.WaitFadeOut)
+ {
+ if (Time.time - moveEndTime > moveEndWaitTime)
+ {
+ nowState = AnimeState.FadeOut;
+ fadeOutSequence = DOTween.Sequence();
+ fadeOutSequence.Append(transZhanLi.DOScale(fadeOutToBigVector, fadeOutToBigDuration).SetEase(fadeOutToBigEaseType));
+ fadeOutSequence.Append(transZhanLi.DOScale(startVector, fadeOutToSmallDuration).SetEase(fadeOutToSmallEaseType).OnComplete(CloseWindow));
+ }
+ }
+ }
+
+ private void ResetToFadeIn()
+ {
+ sequence.Kill();
+ textChangeSequence.Kill();
+ fadeOutSequence.Kill();
+ uiFrame.SetActive(false);
+ fadeInEndTime = 0;
+ moveEndTime = 0;
+ transZhanLi.transform.localScale = startVector;
+ CheckPosition();
+ SetNum();
+ SetInitPosition(basePower, changePower, isAdd);
+ ResetColorA();
+ DisplayNum();
+ nowState = AnimeState.FadeIn;
+ transZhanLi.DOScale(fadeInToBigVector, fadeInToBigDuration).SetEase(fadeInToBigEaseType).OnComplete(() =>
+ {
+ transZhanLi.DOScale(fadeInToSmallVector, fadeInToSmallDuration).SetEase(fadeInToSmallEaseType).OnComplete(() =>
+ {
+ fadeInEndTime = Time.time;
+ nowState = AnimeState.WaitMove;
+
+ uiFrame.SetActive(true);
+ uiFrame.SetLoopCount(1);
+ uiFrame.ResetFrame(uiFrameKey);
+ });
+ });
+ }
+
+ private void ResetToWaitMove()
+ {
+ sequence.Kill();
+ textChangeSequence.Kill();
+ fadeOutSequence.Kill();
+ uiFrame.SetActive(false);
+ fadeInEndTime = Time.time;
+ moveEndTime = 0;
+ transZhanLi.transform.localScale = fadeInToSmallVector;
+ SetNum();
+ SetInitPosition(basePower, changePower, isAdd);
+ ResetColorA();
+ DisplayNum();
+
+ uiFrame.SetActive(true);
+ uiFrame.SetLoopCount(1);
+ uiFrame.ResetFrame(uiFrameKey);
+ nowState = AnimeState.WaitMove;
+ }
+
+ private void SetInitPosition(long basePower, long changePower, bool isAdd)
+ {
+ txtBase.rectTransform.anchorMin = new Vector2(0, 0);
+ txtBase.rectTransform.anchorMax = new Vector2(0, 0);
+ txtBase.rectTransform.pivot = new Vector2(0, 0);
+ txtBase.rectTransform.anchoredPosition = new Vector2(0, 0);
+
+ transChange.anchorMin = new Vector2(0, 0);
+ transChange.anchorMax = new Vector2(0, 0);
+ transChange.pivot = new Vector2(0, 0);
+ string displayBasePowerNum = DisplayBasePowerNum(basePower);
+ int txtBaseTransWidth = GetBaseTransWidth(displayBasePowerNum);
+ float x = txtBaseTransWidth * txtBaseMultiple + baseAndChangeInterval;
+ transChange.anchoredPosition = new Vector2(x, transChangeY);
+
+ txtChange.rectTransform.anchorMin = new Vector2(0, 0);
+ txtChange.rectTransform.anchorMax = new Vector2(0, 0);
+ txtChange.rectTransform.pivot = new Vector2(0, 0);
+ txtChange.rectTransform.anchoredPosition = new Vector2(0, 0);
+
+ imgArrow.rectTransform.anchorMin = new Vector2(0, 0);
+ imgArrow.rectTransform.anchorMax = new Vector2(0, 0);
+ imgArrow.rectTransform.pivot = new Vector2(0, 0);
+ string displayChangePowerNum = DisplayChangePowerNum(isAdd, changePower);
+ int txtChangeTransWidth = GetChangeTransWidth(displayChangePowerNum);
+ x = txtChangeTransWidth * txtChangeMultiple + changeAndArrowInterval;
+ if (!IsHasPoint(changePower))
+ {
+ x += intArrowAddInterval;
+ }
+ imgArrow.rectTransform.anchoredPosition = new Vector2(x, 0);
+ }
+
+ private bool IsHasPoint(long changePower)
+ {
+ var chars = UIHelper.ReplaceLargeArtNum(changePower);
+ for (int i = 0; i < chars.Length; i++)
+ {
+ if (chars[i] == '.')
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private int GetBaseTransWidth(string numStr)
+ {
+ return Mathf.CeilToInt(numStr.Length * baseFontWidth);
+ }
+
+ private int GetChangeTransWidth(string numStr)
+ {
+ return Mathf.CeilToInt(numStr.Length * changeFontWidth);
+ }
+
+ private void SetNum()
+ {
+ nowPower = (long)PlayerMainDate.Instance.prowNum;
+ changePower = (long)PlayerMainDate.Instance.prowNumChange;
+ isAdd = PlayerMainDate.Instance.isAdd;
+ basePower = isAdd ? nowPower - changePower : nowPower + changePower;
+ }
+
+ private void DisplayNum()
+ {
+ txtBase.text = DisplayBasePowerNum(basePower);
+ txtChange.text = DisplayChangePowerNum(isAdd, changePower);
+ imgArrow.SetSprite(DisplayState(isAdd));
+ }
+
+ private string DisplayState(bool isAdd)
+ {
+ return StringUtility.Contact(isAdd ? "FightPointUP" : "FightPointDown");
+ }
+
+ private string DisplayBasePowerNum(long basePower)
+ {
+ StringBuilder stringBuild = new StringBuilder();
+ stringBuild.Append(basePower);
+ return stringBuild.ToString();
+ }
+
+ private string DisplayChangePowerNum(bool isAdd, long changePower)
+ {
+ var chars = UIHelper.ReplaceLargeArtNum(changePower);
+
+ StringBuilder stringBuild = new StringBuilder();
+ if (isAdd)
+ {
+ stringBuild.Append("+");
+ }
+ else
+ {
+ stringBuild.Append("-");
+ }
+ stringBuild.Append(chars);
+ return stringBuild.ToString();
+ }
+
+
+
+ private void ResetColorA()
+ {
+ Color textColor = txtChange.color;
+ textColor.a = 1f;
+ txtChange.color = textColor;
+ textColor = imgArrow.color;
+ textColor.a = 1f;
+ imgArrow.color = textColor;
+ }
+
+ private void CheckPosition()
+ {
+ var type = WindowType.None;
+
+ var _index = powerUpPositions.FindIndex((x) =>
+ {
+ return x.windowType == type;
+ });
+ if (_index != -1)
+ {
+ transZhanLi.transform.localPosition = powerUpPositions[_index].position;
+ }
+ }
+
+ [Serializable]
+ public struct PowerUpPosition
+ {
+ public WindowType windowType;
+ public Vector3 position;
+ }
+
+ public enum WindowType
+ {
+ None,
+ }
+}
\ No newline at end of file
diff --git a/Main/Extensions/DOTweenExtensions.cs.meta b/Main/System/Tip/PowerAddWin.cs.meta
similarity index 68%
copy from Main/Extensions/DOTweenExtensions.cs.meta
copy to Main/System/Tip/PowerAddWin.cs.meta
index e236516..85cfb89 100644
--- a/Main/Extensions/DOTweenExtensions.cs.meta
+++ b/Main/System/Tip/PowerAddWin.cs.meta
@@ -1,7 +1,8 @@
fileFormatVersion: 2
-guid: 0e89b51ad990b594da7083af980fc740
+guid: 156cbeb749a30744bbc420c4fd2ccd81
+timeCreated: 1511767562
+licenseType: Free
MonoImporter:
- externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
--
Gitblit v1.8.0