2 files added
10 files modified
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!1 &5155470835180724710 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 720277956061902697} |
| | | - component: {fileID: 451870121721386500} |
| | | - component: {fileID: 3987857009201838382} |
| | | m_Layer: 5 |
| | | m_Name: AddCurrencyText |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!224 &720277956061902697 |
| | | RectTransform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 5155470835180724710} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: 0, y: 0, z: -0} |
| | | m_LocalScale: {x: 1, y: 1, z: 1} |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 0 |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
| | | m_AnchorMin: {x: 0.5, y: 0.5} |
| | | m_AnchorMax: {x: 0.5, y: 0.5} |
| | | m_AnchoredPosition: {x: -226, y: -872} |
| | | m_SizeDelta: {x: 200, y: 50} |
| | | m_Pivot: {x: 0.5, y: 0.5} |
| | | --- !u!222 &451870121721386500 |
| | | CanvasRenderer: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 5155470835180724710} |
| | | m_CullTransparentMesh: 0 |
| | | --- !u!114 &3987857009201838382 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 5155470835180724710} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | m_Material: {fileID: 0} |
| | | m_Color: {r: 1, g: 1, b: 1, a: 1} |
| | | m_RaycastTarget: 1 |
| | | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} |
| | | m_Maskable: 1 |
| | | m_OnCullStateChanged: |
| | | m_PersistentCalls: |
| | | m_Calls: [] |
| | | m_text: +20 |
| | | m_isRightToLeft: 0 |
| | | m_fontAsset: {fileID: 11400000, guid: 572adb1c73f88e441a1bf998ca9f4ea5, type: 2} |
| | | m_sharedMaterial: {fileID: -3548855653558765056, guid: 572adb1c73f88e441a1bf998ca9f4ea5, |
| | | type: 2} |
| | | m_fontSharedMaterials: [] |
| | | m_fontMaterial: {fileID: 0} |
| | | m_fontMaterials: [] |
| | | m_fontColor32: |
| | | serializedVersion: 2 |
| | | rgba: 4294967295 |
| | | m_fontColor: {r: 1, g: 1, b: 1, a: 1} |
| | | m_enableVertexGradient: 0 |
| | | m_colorMode: 3 |
| | | m_fontColorGradient: |
| | | topLeft: {r: 1, g: 1, b: 1, a: 1} |
| | | topRight: {r: 1, g: 1, b: 1, a: 1} |
| | | bottomLeft: {r: 1, g: 1, b: 1, a: 1} |
| | | bottomRight: {r: 1, g: 1, b: 1, a: 1} |
| | | m_fontColorGradientPreset: {fileID: 0} |
| | | m_spriteAsset: {fileID: 0} |
| | | m_tintAllSprites: 0 |
| | | m_StyleSheet: {fileID: 0} |
| | | m_TextStyleHashCode: -1183493901 |
| | | m_overrideHtmlColors: 0 |
| | | m_faceColor: |
| | | serializedVersion: 2 |
| | | rgba: 4294967295 |
| | | m_fontSize: 36 |
| | | m_fontSizeBase: 36 |
| | | m_fontWeight: 400 |
| | | m_enableAutoSizing: 0 |
| | | m_fontSizeMin: 18 |
| | | m_fontSizeMax: 72 |
| | | m_fontStyle: 0 |
| | | m_HorizontalAlignment: 1 |
| | | m_VerticalAlignment: 256 |
| | | m_textAlignment: 65535 |
| | | m_characterSpacing: 0 |
| | | m_wordSpacing: 0 |
| | | m_lineSpacing: 0 |
| | | m_lineSpacingMax: 0 |
| | | m_paragraphSpacing: 0 |
| | | m_charWidthMaxAdj: 0 |
| | | m_enableWordWrapping: 1 |
| | | m_wordWrappingRatios: 0.4 |
| | | m_overflowMode: 0 |
| | | m_linkedTextComponent: {fileID: 0} |
| | | parentLinkedComponent: {fileID: 0} |
| | | m_enableKerning: 1 |
| | | m_enableExtraPadding: 0 |
| | | checkPaddingRequired: 0 |
| | | m_isRichText: 1 |
| | | m_parseCtrlCharacters: 1 |
| | | m_isOrthographic: 1 |
| | | m_isCullingEnabled: 0 |
| | | m_horizontalMapping: 0 |
| | | m_verticalMapping: 0 |
| | | m_uvLineOffset: 0 |
| | | m_geometrySortingOrder: 0 |
| | | m_IsTextObjectScaleStatic: 0 |
| | | m_VertexBufferAutoSizeReduction: 1 |
| | | m_useMaxVisibleDescender: 1 |
| | | m_pageToDisplay: 1 |
| | | m_margin: {x: 0, y: 0, z: 0, w: 0} |
| | | m_isUsingLegacyAnimationComponent: 0 |
| | | m_isVolumetricText: 0 |
| | | m_hasFontAssetChanged: 0 |
| | | m_baseMaterial: {fileID: 0} |
| | | m_maskOffset: {x: 0, y: 0, z: 0, w: 0} |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 999d11a8d7094b646970c8002c0bd2fa |
| | | PrefabImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | DisplayText: {fileID: 4623057511285327670} |
| | | addCurrencyPrefab: {fileID: 5155470835180724710, guid: 999d11a8d7094b646970c8002c0bd2fa, |
| | | type: 3} |
| | | --- !u!1 &4623057513087273499 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | |
| | | - target: {fileID: 8530610553866603046, guid: e30e86a0b720a524384db91a4eb22bcb, |
| | | type: 3} |
| | | propertyPath: m_AnchoredPosition.y |
| | | value: 1405.2777 |
| | | value: 259.83737 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 8530610554782125076, guid: e30e86a0b720a524384db91a4eb22bcb, |
| | | type: 3} |
| | |
| | | m_Modification: |
| | | m_TransformParent: {fileID: 1340671931} |
| | | m_Modifications: |
| | | - target: {fileID: 1864109698340928006, guid: 29da21b318f42054db30c52123aa4dbf, |
| | | type: 3} |
| | | propertyPath: m_AnchoredPosition.y |
| | | value: -15 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 1864109698340928006, guid: 29da21b318f42054db30c52123aa4dbf, |
| | | type: 3} |
| | | propertyPath: m_LocalPosition.z |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 4623057512524248738, guid: 29da21b318f42054db30c52123aa4dbf, |
| | | type: 3} |
| | | propertyPath: m_AnchoredPosition.y |
| | | value: -0.000030517578 |
| | | value: -0.000061035156 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 4623057512704841786, guid: 29da21b318f42054db30c52123aa4dbf, |
| | | type: 3} |
| | |
| | | /// </summary> |
| | | public int currentCurrency { get; private set; } |
| | | |
| | | public int lastCurrency { get; private set; } |
| | | |
| | | /// <summary> |
| | | /// Occurs when currency changed. |
| | | /// </summary> |
| | |
| | | { |
| | | if (increment != 0) |
| | | { |
| | | lastCurrency = currentCurrency; |
| | | currentCurrency += increment; |
| | | if (currencyChanged != null) |
| | | { |
| | |
| | | OpenAllTowerGrid, |
| | | // 关闭了精灵升级界面 |
| | | ElfUpgradePanelClosed, |
| | | // 不够开塔,也不够买塔 |
| | | SetTowerGridOpenRed, |
| | | |
| | | } |
| | | |
| | |
| | | tgo.SetBuyBtnInfo(x, y, this); |
| | | tgo.cashText.SetText(TowerPlacementGridEndless.GRID_OPENCASH.ToString()); |
| | | m_arrTGO[x, y] = tgo; |
| | | tgo.CheckCurrencyEnough(); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (m_arrTGO[x, y] != null) |
| | | { |
| | | m_arrTGO[x, y].cashText.SetText(GRID_OPENCASH.ToString()); |
| | | m_arrTGO[x, y].CheckCurrencyEnough(); |
| | | } |
| | | } |
| | | } |
| | |
| | | void Start() |
| | | { |
| | | bWaitOpen = false; |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.SetTowerGridOpenRed, SetRed); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Subscribe to the level manager |
| | | /// </summary> |
| | | protected virtual void OnEnable() |
| | | { |
| | | if (EndlessLevelManager.instanceExists) |
| | | EndlessLevelManager.instance.Currency.currencyChanged += OnCurrencyChanged; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Unsubscribe from the level manager |
| | | /// </summary> |
| | | protected virtual void OnDisable() |
| | | { |
| | | if (EndlessLevelManager.instanceExists) |
| | | EndlessLevelManager.instance.Currency.currencyChanged -= OnCurrencyChanged; |
| | | } |
| | | |
| | | private void OnCurrencyChanged() |
| | | { |
| | | CheckCurrencyEnough(); |
| | | } |
| | | |
| | | public void CheckCurrencyEnough() |
| | | { |
| | | int result; |
| | | int.TryParse(cashText.text.ToString(), out result); |
| | | int current = EndlessLevelManager.instance.Currency.currentCurrency; |
| | | |
| | | if (current >= result) |
| | | cashText.color = new Color(1f, 1f, 1f); |
| | | else |
| | | cashText.color = new Color(0.5f, 0.5f, 0.5f); |
| | | } |
| | | |
| | | private void SetRed() |
| | | { |
| | | int result; |
| | | int.TryParse(cashText.text.ToString(), out result); |
| | | int current = EndlessLevelManager.instance.Currency.currentCurrency; |
| | | |
| | | if (current < result) |
| | | cashText.color = new Color(1f, 0f, 0f); |
| | | } |
| | | |
| | | public void SetBuyBtnInfo(int x, int y, TowerPlacementGridEndless tpg) |
| | |
| | | |
| | | if (!isUpgradeTowerLevel && startTime >= JsonDataCenter.DOUBLE_GEM_TIME) |
| | | { |
| | | EndlessGameUI.instance.UpgradeAllTowerMinLevel(1); |
| | | EndlessRandomTower.instance.UpdateDescDisplay(); |
| | | isUpgradeTowerLevel = true; |
| | | } |
| | |
| | | using TMPro; |
| | | using TowerDefense.Level; |
| | | using UnityEngine; |
| | | using DG.Tweening; |
| | | using Core.Utilities; |
| | | |
| | | namespace TowerDefense.UI.HUD |
| | | { |
| | |
| | | protected Currency currency; |
| | | |
| | | private ParticleSystem goldGetPs;//金币获得动画 |
| | | |
| | | /// <summary> |
| | | /// 每秒增加的金币数量 |
| | | /// </summary> |
| | | private int addCurrencyPerSecond; |
| | | |
| | | private float duration; |
| | | |
| | | /// <summary> |
| | | /// 一秒前金币 |
| | | /// </summary> |
| | | private int lastCurrency; |
| | | |
| | | [SerializeField] |
| | | private GameObject addCurrencyPrefab; |
| | | |
| | | private void Start() |
| | | { |
| | |
| | | protected void UpdateDisplay() |
| | | { |
| | | int current = currency.currentCurrency; |
| | | //DisplayText.text = AddNumberSemi(current.ToString()); |
| | | int lastCurrency = currency.lastCurrency; |
| | | DisplayText.text = current.ToString(); |
| | | |
| | | if (lastCurrency > 0 && current - lastCurrency > 0) |
| | | ToBig().OnComplete(ToSmall); |
| | | } |
| | | |
| | | public void PlayGetGoldPS(){ |
| | | private Tweener ToBig() |
| | | { |
| | | return DOTween.To( |
| | | () => DisplayText.transform.localScale, |
| | | (Vector3 v) => DisplayText.transform.localScale = v, |
| | | new Vector3(1.15f, 1.15f, 1.15f), |
| | | 0.15f); |
| | | } |
| | | |
| | | private void ToSmall() |
| | | { |
| | | DOTween.To( |
| | | () => DisplayText.transform.localScale, |
| | | (Vector3 v) => DisplayText.transform.localScale = v, |
| | | new Vector3(1f, 1f, 1f), |
| | | 0.1f); |
| | | } |
| | | |
| | | public void PlayGetGoldPS() |
| | | { |
| | | goldGetPs.Play(); |
| | | } |
| | | |
| | |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | private void Update() |
| | | { |
| | | FloatAddCurrency(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 飘1s内增加的金币 |
| | | /// </summary> |
| | | private void FloatAddCurrency() |
| | | { |
| | | if (duration <= 0.0001f) |
| | | { |
| | | lastCurrency = currency.currentCurrency; |
| | | } |
| | | |
| | | duration += Time.deltaTime; |
| | | |
| | | if (duration >= 1f) |
| | | { |
| | | int add = currency.currentCurrency - lastCurrency; |
| | | |
| | | if (add > 0) |
| | | { |
| | | GameObject obj = Instantiate(addCurrencyPrefab); |
| | | obj.transform.SetParent(GameObject.Find("UICamera/BottomCanvas/Panel/Bottom/CurrencyContainer").transform, false); |
| | | obj.transform.localPosition = new Vector3(148f, -30f, 0f); |
| | | obj.transform.localScale = new Vector3(0.66f, 0.66f, 0.66f); |
| | | TextMeshProUGUI textMeshProUGUI = obj.GetComponent<TextMeshProUGUI>(); |
| | | textMeshProUGUI.text = $"+{add}"; |
| | | |
| | | DOTween.To( |
| | | () => obj.transform.localPosition.y, |
| | | (float v) => |
| | | { |
| | | Vector3 pos = obj.transform.localPosition; |
| | | pos.y = v; |
| | | obj.transform.localPosition = pos; |
| | | }, |
| | | -20f, 0.2f); |
| | | Destroy(obj, 0.5f); |
| | | } |
| | | |
| | | duration = 0f; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | protected TextMeshProUGUI towerPriceText; |
| | | |
| | | protected bool tdBuyDisable = false; |
| | | public bool tdBuyDisable { get; protected set; } = false; |
| | | |
| | | /// <summary> |
| | | /// 鼠标在移动一个Tower之前,要隐藏的Tower数据和指针。 |
| | |
| | | else if (EndlessLevelManager.instanceExists && IsSubstitute(pointerInfo)) |
| | | { |
| | | CheckCanChangePos(pointerInfo); |
| | | if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME) |
| | | UpgradeAllTowerMinLevel(1); |
| | | } |
| | | // 当前是Skill塔位的状态. |
| | | else if (bSkill) |
| | |
| | | public void ChangeBtnClick() |
| | | { |
| | | randomBtn.onClick.RemoveAllListeners(); |
| | | randomBtn.onClick.AddListener(delegate () { onClick(EFeatureTower.NULL); }); |
| | | randomBtn.onClick.AddListener(() => |
| | | { |
| | | AudioSourceManager.Ins.Play(AudioEnum.UIDisable); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (EndlessGameUI.instance.tdBuyDisable) |
| | | { |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.SetTowerGridOpenRed); |
| | | return; |
| | | } |
| | | |
| | | AudioSourceManager.Ins.Play(AudioEnum.UI); |
| | | |
| | | Tower newTower = GetRandomTower(towerType, false); |