为了适配按钮,固定新手引导购买按钮的rect
修改塔生成区域
适配地图
5 files added
8 files modified
| | |
| | | - _OcclusionStrength: 1 |
| | | - _Parallax: 0.02 |
| | | - _Slider: 81.39478 |
| | | - _SliderX: 79 |
| | | - _SliderY: 265 |
| | | - _SliderX: 189 |
| | | - _SliderY: 73.5 |
| | | - _SmoothnessTextureChannel: 0 |
| | | - _SpecularHighlights: 1 |
| | | - _SrcBlend: 1 |
| | |
| | | - _UseUIAlphaClip: 0 |
| | | - _ZWrite: 1 |
| | | m_Colors: |
| | | - _Center: {r: -145, g: 155, b: 0, a: 0} |
| | | - _Center: {r: -3, g: 98, b: 0, a: 0} |
| | | - _Color: {r: 1, g: 1, b: 1, a: 1} |
| | | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
| | | m_BuildTextureStacks: [] |
| | |
| | | m_Scale: {x: 1, y: 1} |
| | | m_Offset: {x: 0, y: 0} |
| | | - _MainTex: |
| | | m_Texture: {fileID: 2800000, guid: 00ee2360b2adbe345ae50bae05342fc3, type: 3} |
| | | m_Texture: {fileID: 2800000, guid: 9dc83c6d4f432364baea6e9c98a7498a, type: 3} |
| | | m_Scale: {x: 1, y: 1} |
| | | m_Offset: {x: 0, y: 0} |
| | | - _MetallicGlossMap: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9dc83c6d4f432364baea6e9c98a7498a |
| | | TextureImporter: |
| | | internalIDToNameTable: [] |
| | | externalObjects: {} |
| | | serializedVersion: 11 |
| | | mipmaps: |
| | | mipMapMode: 0 |
| | | enableMipMap: 1 |
| | | sRGBTexture: 1 |
| | | linearTexture: 0 |
| | | fadeOut: 0 |
| | | borderMipMap: 0 |
| | | mipMapsPreserveCoverage: 0 |
| | | alphaTestReferenceValue: 0.5 |
| | | mipMapFadeDistanceStart: 1 |
| | | mipMapFadeDistanceEnd: 3 |
| | | bumpmap: |
| | | convertToNormalMap: 0 |
| | | externalNormalMap: 0 |
| | | heightScale: 0.25 |
| | | normalMapFilter: 0 |
| | | isReadable: 0 |
| | | streamingMipmaps: 0 |
| | | streamingMipmapsPriority: 0 |
| | | vTOnly: 0 |
| | | grayScaleToAlpha: 0 |
| | | generateCubemap: 6 |
| | | cubemapConvolution: 0 |
| | | seamlessCubemap: 0 |
| | | textureFormat: 1 |
| | | maxTextureSize: 2048 |
| | | textureSettings: |
| | | serializedVersion: 2 |
| | | filterMode: -1 |
| | | aniso: -1 |
| | | mipBias: -100 |
| | | wrapU: -1 |
| | | wrapV: -1 |
| | | wrapW: -1 |
| | | nPOTScale: 1 |
| | | lightmap: 0 |
| | | compressionQuality: 50 |
| | | spriteMode: 0 |
| | | spriteExtrude: 1 |
| | | spriteMeshType: 1 |
| | | alignment: 0 |
| | | spritePivot: {x: 0.5, y: 0.5} |
| | | spritePixelsToUnits: 100 |
| | | spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
| | | spriteGenerateFallbackPhysicsShape: 1 |
| | | alphaUsage: 1 |
| | | alphaIsTransparency: 0 |
| | | spriteTessellationDetail: -1 |
| | | textureType: 0 |
| | | textureShape: 1 |
| | | singleChannelComponent: 0 |
| | | maxTextureSizeSet: 0 |
| | | compressionQualitySet: 0 |
| | | textureFormatSet: 0 |
| | | ignorePngGamma: 0 |
| | | applyGammaDecoding: 0 |
| | | platformSettings: |
| | | - serializedVersion: 3 |
| | | buildTarget: DefaultTexturePlatform |
| | | maxTextureSize: 2048 |
| | | resizeAlgorithm: 0 |
| | | textureFormat: -1 |
| | | textureCompression: 1 |
| | | compressionQuality: 50 |
| | | crunchedCompression: 0 |
| | | allowsAlphaSplitting: 0 |
| | | overridden: 0 |
| | | androidETC2FallbackOverride: 0 |
| | | forceMaximumCompressionQuality_BC6H_BC7: 0 |
| | | spriteSheet: |
| | | serializedVersion: 2 |
| | | sprites: [] |
| | | outline: [] |
| | | physicsShape: [] |
| | | bones: [] |
| | | spriteID: |
| | | internalID: 0 |
| | | vertices: [] |
| | | indices: |
| | | edges: [] |
| | | weights: [] |
| | | secondaryTextures: [] |
| | | spritePackingTag: |
| | | pSDRemoveMatte: 0 |
| | | pSDShowRemoveMatteOption: 0 |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | 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: -150, y: -198} |
| | | m_AnchoredPosition: {x: -156, y: -97} |
| | | m_SizeDelta: {x: 150, y: 160} |
| | | m_Pivot: {x: 0.5, y: 0.5} |
| | | --- !u!222 &1513328901255623773 |
| | |
| | | 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: 6, y: -198} |
| | | m_AnchoredPosition: {x: 6, y: -108} |
| | | m_SizeDelta: {x: 150, y: 160} |
| | | m_Pivot: {x: 0.5, y: 0.5} |
| | | --- !u!222 &1008060919980179297 |
| | |
| | | bOpponentSide: 1 |
| | | areaMesh: {fileID: 122104238} |
| | | weight: 1 |
| | | --- !u!1001 &110324107 |
| | | PrefabInstance: |
| | | m_ObjectHideFlags: 0 |
| | | serializedVersion: 2 |
| | | m_Modification: |
| | | m_TransformParent: {fileID: 0} |
| | | m_Modifications: |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalPosition.x |
| | | value: 1417 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalPosition.y |
| | | value: 940 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalPosition.z |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalRotation.x |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalRotation.y |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalRotation.z |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalRotation.w |
| | | value: 1 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_RootOrder |
| | | value: 10 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalEulerAnglesHint.x |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalEulerAnglesHint.y |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326715, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_LocalEulerAnglesHint.z |
| | | value: 0 |
| | | objectReference: {fileID: 0} |
| | | - target: {fileID: 3091314759354326717, guid: 91d321cd869bc0c47808f6fd7d755ae3, |
| | | type: 3} |
| | | propertyPath: m_Name |
| | | value: ClearCamera |
| | | objectReference: {fileID: 0} |
| | | m_RemovedComponents: [] |
| | | m_SourcePrefab: {fileID: 100100000, guid: 91d321cd869bc0c47808f6fd7d755ae3, type: 3} |
| | | --- !u!43 &115306053 |
| | | Mesh: |
| | | m_ObjectHideFlags: 0 |
| | |
| | | - component: {fileID: 580839157} |
| | | - component: {fileID: 580839156} |
| | | - component: {fileID: 580839155} |
| | | - component: {fileID: 580839158} |
| | | m_Layer: 0 |
| | | m_Name: BackCamera |
| | | m_TagString: Untagged |
| | |
| | | m_Father: {fileID: 0} |
| | | m_RootOrder: 8 |
| | | m_LocalEulerAnglesHint: {x: 90.800995, y: 0, z: 0} |
| | | --- !u!114 &580839158 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 580839154} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: ef302018e3b8e2b47add4bb149612913, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | --- !u!1001 &585504008 |
| | | PrefabInstance: |
| | | m_ObjectHideFlags: 0 |
| | |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 1632078501} |
| | | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
| | | m_LocalPosition: {x: -25.58, y: 0, z: -28.23} |
| | | m_LocalPosition: {x: -25.58, y: 0, z: -26.63} |
| | | m_LocalScale: {x: 9.25, y: 1, z: 9.22} |
| | | m_Children: [] |
| | | m_Father: {fileID: 1765964312} |
| | |
| | | waitBuyBtnPrefab: {fileID: 1470395276146401766, guid: 9d592be254a1285438f8e78c5e1b1bc5, |
| | | type: 3} |
| | | gridFreePos: 0.14 |
| | | gridFreePos2: 0.14 |
| | | gridFreePos2: 0.29 |
| | | gridFreePos3: 0.14 |
| | | gridFreePos4: 0.14 |
| | | dimensions: |
| | | x: 5 |
| | | y: 4 |
| | |
| | | ImageTowerPos2 towerPos2;//塔位标识 |
| | | |
| | | GameObject towerBuyBtn;//购买宝石按钮 |
| | | |
| | | Vector2 towerBuyBtnPos; |
| | | Image backgroundImg;//用来接受空白点击事件的图片 |
| | | |
| | | RectTransform dragHandImg;//拖动标识手指 |
| | |
| | | backgroundImg = transform.Find("Button").GetComponent<Image>(); |
| | | |
| | | towerBuyBtn = GameObject.Find("UICamera/BottomCanvas/Panel/TowerBuyBtn"); |
| | | towerBuyBtnPos = new Vector2(-3, -862); |
| | | tipsUI = transform.Find("Tips").gameObject; |
| | | tipsUI.transform.SetAsLastSibling();//把tips放在最下面 |
| | | |
| | |
| | | SetRimActive(true); |
| | | RectTransform rt = target.GetComponent<RectTransform>(); |
| | | image_Rim_Rect.anchoredPosition = rt.anchoredPosition; |
| | | if (target.gameObject.name == "TowerBuyBtn") |
| | | { |
| | | image_Rim_Rect.anchoredPosition = towerBuyBtnPos; |
| | | } |
| | | image_Rim_Rect.sizeDelta = (rt.sizeDelta * rt.localScale) + rimOffset; |
| | | if (image_Rim_Rect.sizeDelta.x > 200) |
| | | { |
| | |
| | | } |
| | | //maskObj.Init(target); |
| | | //maskObj.ShowImmediately(); |
| | | if (target.gameObject.name == "TowerBuyBtn") |
| | | { |
| | | maskObj.InitForCamera(target, towerBuyBtnPos, x, y); |
| | | } |
| | | else |
| | | { |
| | | maskObj.InitForCamera(target, x, y); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public void InitForCamera(Image target, Vector2 center ,float x, float y) |
| | | { |
| | | this.target = target; |
| | | if (eventPenetrate != null) |
| | | { |
| | | eventPenetrate.SetTargetImage(target); |
| | | } |
| | | |
| | | material.SetVector("_Center", center); |
| | | material.SetFloat("_SliderX", x); |
| | | material.SetFloat("_SliderY", y); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 收缩速度 |
| | | /// </summary> |
| | |
| | | |
| | | public float gridFreePos2; |
| | | |
| | | public float gridFreePos3; |
| | | |
| | | public float gridFreePos4; |
| | | |
| | | /// <summary> |
| | | /// The dimensions of the grid |
| | | /// </summary> |
| | |
| | | freePos = gridFreePos; |
| | | else if (gridPosition.y == 2) |
| | | freePos = gridFreePos2; |
| | | else if (gridPosition.y == 1) |
| | | { |
| | | freePos = gridFreePos3; |
| | | } |
| | | else if (gridPosition.y == 0) |
| | | { |
| | | freePos = gridFreePos4; |
| | | } |
| | | // Calculate scaled local position |
| | | Vector3 localPos = new Vector3(gridPosition.x + (sizeOffset.x * 0.5f), 0, gridPosition.y + (sizeOffset.y * 0.5f) + freePos) * |
| | | gridSize; |
| | |
| | | float[] gapArr = { 0.2f, 0.7f }; |
| | | m_arrTGO = new EndlessTowerGridOpen[dimensions.x, dimensions.y]; |
| | | |
| | | GameObject container = GameObject.Find("BuyButtonContainer"); |
| | | float[] xup = { -0.6f, -0.3f, 0, 0.3f, 0.6f }; |
| | | for (int x = 0; x < dimensions.x; ++x) |
| | | { |
| | | for (int y = dimensions.y - AttackRowNumbers; y < dimensions.y; ++y) |
| | | { |
| | | if (m_arrGridType[x, y] != PlacementGridType.EGridWaitBuy) continue; |
| | | |
| | | GameObject container = GameObject.Find("BuyButtonContainer"); |
| | | Button buyButton = Instantiate(waitBuyBtnPrefab); |
| | | buyButton.transform.SetParent(container.transform); |
| | | |
| | | Vector3 pos = buyButton.transform.position; |
| | | pos.x = arrGridCentPos[x, y].x + (x - 2) * gapArr[3 - y]; |
| | | pos.z = arrGridCentPos[x, y].y + 6f; |
| | | pos.x = arrGridCentPos[x, y].x + (x - 2) * gapArr[3 - y] + xup[x]; |
| | | |
| | | if (y == 2) |
| | | { |
| | | pos.z = arrGridCentPos[x, y].y + 9f; |
| | | } |
| | | else if (y == 3) |
| | | { |
| | | pos.z = arrGridCentPos[x, y].y + 7f; |
| | | } |
| | | pos.y = 30; |
| | | buyButton.transform.position = pos; |
| | | buyButton.transform.localRotation = Quaternion.identity; |
| | |
| | | freePos = gridFreePos; |
| | | else if (y > 0 && y == dimensions.y - 2) |
| | | freePos = gridFreePos2; |
| | | |
| | | else if (y > 0 && y == dimensions.y - 3) |
| | | freePos = gridFreePos3; |
| | | else if (y == dimensions.y - 4) |
| | | freePos = gridFreePos4; |
| | | for (int x = 0; x < dimensions.x; x++) |
| | | { |
| | | var position = new Vector3((x + 0.5f) * gridSize, 0, (y + 0.5f) * gridSize + freePos); |
| | |
| | | //查询是否已经做过了新手引导 |
| | | int guide = PlayerPrefs.GetInt("GemBattleGuide"); |
| | | GameConfig.IsNewbie = guide == 0; |
| | | |
| | | //GameConfig.IsNewbie = false; |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | Debug.Log("开始新手引导"); |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fe16a79e49f41254fb4a774dd3e0bb21 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class Fitter : MonoBehaviour |
| | | { |
| | | private Camera myCamera; |
| | | private Camera myCameraUI; |
| | | private Camera myCamera3D; |
| | | |
| | | private float width = 1080f; |
| | | private float height = 1920f; |
| | | |
| | | private float size = 64f;//在1080*1920情况下的大小 |
| | | private float ratio; |
| | | // Start is called before the first frame update |
| | | void Awake() |
| | | { |
| | | ratio = width / height; |
| | | |
| | | myCamera = GetComponent<Camera>(); |
| | | myCameraUI = GameObject.Find("UICamera").GetComponent<Camera>(); |
| | | myCamera3D = GameObject.Find("SceneCamera3D").GetComponent<Camera>(); |
| | | |
| | | Calculate(); |
| | | //myCamera.orthographicSize = myCamera.orthographicSize * 1920 / 1080 * Screen.height / Screen.width; |
| | | |
| | | } |
| | | |
| | | // Update is called once per frame |
| | | void Update() |
| | | { |
| | | if (Input.GetKeyDown(KeyCode.Q)) |
| | | { |
| | | Calculate(); |
| | | } |
| | | } |
| | | |
| | | void Calculate() |
| | | { |
| | | float tmpRatio = (float)Screen.width / (float)Screen.height; |
| | | float newRatio = ratio - tmpRatio + 1.0f; |
| | | Debug.Log($"开始变化大小,ratio:{ratio} tmpRatio:{tmpRatio} newRatio{newRatio}"); |
| | | myCamera.orthographicSize = size * newRatio; |
| | | if (myCameraUI != null){ |
| | | myCameraUI.orthographicSize = size * newRatio; |
| | | } |
| | | if (myCamera3D != null) |
| | | { |
| | | myCamera3D.fieldOfView = 60 * newRatio; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ef302018e3b8e2b47add4bb149612913 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |