wangguan
2020-12-22 ca7b565cd73e47a4c83189e35544c892b781cea1
修改拖拽
增加未开启塔位增加红色标记
4 files added
5 files modified
369 ■■■■■ changed files
Assets/Materials/UI/tileCanNotPlace.mat 78 ●●●●● patch | view | raw | blame | history
Assets/Materials/UI/tileCanNotPlace.mat.meta 8 ●●●●● patch | view | raw | blame | history
Assets/Prefabs/UI/PlacementTileMobile.prefab 108 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Placement/TowerPlacementGridEndless.cs 21 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs 7 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs 42 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/HUD/PlacementTile.cs 11 ●●●●● patch | view | raw | blame | history
Assets/UI/Fight/范围错误.png patch | view | raw | blame | history
Assets/UI/Fight/范围错误.png.meta 94 ●●●●● patch | view | raw | blame | history
Assets/Materials/UI/tileCanNotPlace.mat
New file
@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
  serializedVersion: 6
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_Name: tileCanNotPlace
  m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0}
  m_ShaderKeywords:
  m_LightmapFlags: 4
  m_EnableInstancingVariants: 0
  m_DoubleSidedGI: 0
  m_CustomRenderQueue: -1
  stringTagMap: {}
  disabledShaderPasses: []
  m_SavedProperties:
    serializedVersion: 3
    m_TexEnvs:
    - _BumpMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailAlbedoMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailMask:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailNormalMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _EmissionMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MainTex:
        m_Texture: {fileID: 2800000, guid: 88b08067e1ff0d64fb74c916398dd462, type: 3}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MetallicGlossMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _OcclusionMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _ParallaxMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    m_Floats:
    - _BumpScale: 1
    - _Cutoff: 0.5
    - _DetailNormalMapScale: 1
    - _DstBlend: 0
    - _GlossMapScale: 1
    - _Glossiness: 0.5
    - _GlossyReflections: 1
    - _Metallic: 0
    - _Mode: 0
    - _OcclusionStrength: 1
    - _Parallax: 0.02
    - _SmoothnessTextureChannel: 0
    - _SpecularHighlights: 1
    - _SrcBlend: 1
    - _UVSec: 0
    - _ZWrite: 1
    m_Colors:
    - _Color: {r: 1, g: 1, b: 1, a: 1}
    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
  m_BuildTextureStacks: []
Assets/Materials/UI/tileCanNotPlace.mat.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a77950a0ae2d8e84a8590abc1f176d35
NativeFormatImporter:
  externalObjects: {}
  mainObjectFileID: 0
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Prefabs/UI/PlacementTileMobile.prefab
@@ -31,7 +31,6 @@
  - {fileID: 4082878821884824}
  - {fileID: 3708897891681601760}
  - {fileID: 5551798738058946706}
  - {fileID: 7663500724507464268}
  - {fileID: 7028420458808586989}
  - {fileID: 3619991940650253911}
  - {fileID: 4800866152402141593}
@@ -58,6 +57,7 @@
  destroyedMat: {fileID: 2100000, guid: 24cf3ab9c181b3245a435a32a6ee4cec, type: 2}
  canPlaceRenderer: {fileID: 5722111975221064870}
  canPlaceMat: {fileID: 2100000, guid: 434316934db1c90498f004f124d7c733, type: 2}
  canNotPlaceMat: {fileID: 2100000, guid: a77950a0ae2d8e84a8590abc1f176d35, type: 2}
  selectMat: {fileID: 2100000, guid: 3b7aa7626a2d4674ca2aa32958f14ca9, type: 2}
  myOpenPS: {fileID: 5639653971360257455}
  myPutPS: {fileID: 5446732126781949981}
@@ -370,7 +370,7 @@
    - target: {fileID: 8239024443936845406, guid: 2f8f8871ead832445a20709c09832794,
        type: 3}
      propertyPath: m_RootOrder
      value: 6
      value: 5
      objectReference: {fileID: 0}
    - target: {fileID: 8239024443936845406, guid: 2f8f8871ead832445a20709c09832794,
        type: 3}
@@ -456,7 +456,7 @@
    - target: {fileID: 2463468008962009366, guid: bdadf6527322ae8419ac57e78e81dfc9,
        type: 3}
      propertyPath: m_RootOrder
      value: 4
      value: 3
      objectReference: {fileID: 0}
    - target: {fileID: 2463468008962009366, guid: bdadf6527322ae8419ac57e78e81dfc9,
        type: 3}
@@ -527,106 +527,6 @@
    type: 3}
  m_PrefabInstance: {fileID: 4874592655082232827}
  m_PrefabAsset: {fileID: 0}
--- !u!1001 &5052097780309765736
PrefabInstance:
  m_ObjectHideFlags: 0
  serializedVersion: 2
  m_Modification:
    m_TransformParent: {fileID: 4376446327882660}
    m_Modifications:
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalPosition.x
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalPosition.y
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalPosition.z
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalRotation.x
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalRotation.y
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalRotation.z
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalRotation.w
      value: 1
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_RootOrder
      value: 3
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.x
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.y
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalEulerAnglesHint.z
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalScale.x
      value: 0.12647022
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_LocalScale.z
      value: 0.09259259
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246885, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_Name
      value: Effect_UI_BaoShiShengJi_TiShi
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246885, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_IsActive
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397261047448469, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: playOnAwake
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397261319985792, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: playOnAwake
      value: 0
      objectReference: {fileID: 0}
    m_RemovedComponents: []
  m_SourcePrefab: {fileID: 100100000, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad, type: 3}
--- !u!4 &7663500724507464268 stripped
Transform:
  m_CorrespondingSourceObject: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
    type: 3}
  m_PrefabInstance: {fileID: 5052097780309765736}
  m_PrefabAsset: {fileID: 0}
--- !u!1001 &8416641207410710028
PrefabInstance:
  m_ObjectHideFlags: 0
@@ -682,7 +582,7 @@
    - target: {fileID: 5111904333056534619, guid: 19e5a86a7c5fc9e4ea8ff8768e0e368e,
        type: 3}
      propertyPath: m_RootOrder
      value: 5
      value: 4
      objectReference: {fileID: 0}
    - target: {fileID: 5111904333056534619, guid: 19e5a86a7c5fc9e4ea8ff8768e0e368e,
        type: 3}
Assets/Scripts/TowerDefense/Towers/Placement/TowerPlacementGridEndless.cs
@@ -1077,6 +1077,11 @@
                        m_Tiles[x, y] = newTile;
                        newTile.SetTileType(m_arrGridType[x, y]);
                        newTile.SetRender(false, "");//初始化不显示
                        if (m_arrGridType[x, y] == PlacementGridType.EGridWaitBuy)
                        {
                            newTile.SetWarning(true);
                        }
                    }
                }
@@ -1155,9 +1160,18 @@
        /// <param name="y"></param>
        public void CheckCanPlaceUpdate(int x, int y, bool isEmpty, string towerName)
        {
            CloseCanPlace();
            currentCanPlace = m_Tiles[x, y];
            currentCanPlace?.SetRender(true, isEmpty ? towerName : "");
            if (currentCanPlace == null)
            {
                //Debug.Log("第一次");
                currentCanPlace = m_Tiles[x, y];
                currentCanPlace?.SetRender(true, isEmpty ? towerName : "");
            }
            else if (currentCanPlace.GridPosition.x != x || currentCanPlace.GridPosition.y != y)
            {
                CloseCanPlace();
                currentCanPlace = m_Tiles[x, y];
                currentCanPlace?.SetRender(true, isEmpty ? towerName : "");
            }
            // if (isEmpty)
            // {
            //     currentCanPlace.SetTowerVirtualshadow(towerName);
@@ -1169,6 +1183,7 @@
        /// </summary>
        public void CloseCanPlace()
        {
            //Debug.Log("CloseCanPlace:" + currentCanPlace);
            if (currentCanPlace != null)
            {
                currentCanPlace.SetRender(false, "");
Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs
@@ -71,6 +71,11 @@
           Application.platform == RuntimePlatform.WindowsPlayer)
            {
                GameConfig.useSDK = false;
                GMBtn.SetActive(true);
            }
            else
            {
                GMBtn.SetActive(false);
            }
            root = new GameObject("ManagerRoot");
@@ -158,7 +163,7 @@
        transform.Find("Panel/BuffPreviewButton").gameObject.SetActive(false);
        transform.Find("Panel/SwitchSpeed").gameObject.SetActive(false);
        GMBtn.SetActive(false);
        GameConfig.EnergyCount = 0;
        GameConfig.SkillLevel = 1;
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -189,6 +189,9 @@
        /// </summary>
        Camera m_Camera;
        //Camera m_CameraBG;
        /// <summary>
        /// Current tower placeholder. Will be null if not in the <see cref="State.Building" /> state.
        /// </summary>
@@ -1149,19 +1152,21 @@
                    else if (m_GridPosition.y == 2 || m_GridPosition.y == 3)
                    {
                        //Debug.Log("已上阵区域,如果是空格子就强行吸附,先判断是否有塔");
                        //pointerInfo.currentPosition += new Vector2(0, -25f);
                        checkTowerPlaceTower = isFreeAttackGridOnDrag(pointerInfo);
                        if (checkTowerPlaceTower != null)
                        {
                            //Debug.Log(checkTowerPlaceTower.name);
                            //Debug.Log($"checkTowerPlaceTower.name:{checkTowerPlaceTower.name}  m_GridPosition:{m_GridPosition}");
                            if (m_CurrentTower.controller.towerFeature == EFeatureTower.NULL)
                            {
                                if (checkTowerPlaceTower.bInAttackMode)
                                {
                                    //Debug.Log("检测到了塔");
                                    //鼠标检测到了塔
                                    (m_CurrentArea as TowerPlacementGridEndless).CheckCanPlaceUpdate(m_GridPosition.x, m_GridPosition.y, false, "");
                                    (m_CurrentArea as TowerPlacementGridEndless).CheckCanPlaceUpdate(checkTowerPlaceTower.gridPosition.x, checkTowerPlaceTower.gridPosition.y, false, "");
                                }
                                else
                                {
@@ -1209,9 +1214,13 @@
                            }
                            else
                            {
                                CloseCanPlace();
                                //CloseCanPlace();
                                //Debug.Log("上阵区域,没有开放的塔位");
                                (m_CurrentArea as TowerPlacementGridEndless).CheckCanPlaceUpdate(m_GridPosition.x, m_GridPosition.y, true, "");
                                m_CurrentTower.transform.position = (m_CurrentArea as TowerPlacementGridEndless).GridToWorld(m_GridPosition, m_CurrentTower.controller.dimensions);
                            }
                        }
                    }
@@ -1367,7 +1376,7 @@
            if (sTower == null)
                return false;
            Debug.Log("开始检测是否可以交换塔");
            //Debug.Log("开始检测是否可以交换塔");
            //if (sTower.bInAttackMode == towerToMove.bInAttackMode)
            {
                IntVector2 v1 = new IntVector2(towerToMove.gridPosition.x, towerToMove.gridPosition.y);
@@ -1580,6 +1589,7 @@
            return controller;
        }
        private Vector2 dragOffect = new Vector2(0, -55f);
        /// <summary>
        /// Position the ghost tower at the given pointer
        /// </summary>
@@ -1592,15 +1602,29 @@
                return;
                //throw new InvalidOperationException("Trying to move the tower ghost when we don't have one");
            }
            // 我操,终于可以了!ATTENTION TO OPP:
            PointerInfo tp = new PointerActionInfo();
            tp.currentPosition = pointerInfo.currentPosition + dragOffect;
            tp.previousPosition = pointerInfo.previousPosition;
            tp.delta = pointerInfo.delta;
            tp.startedOverUI = pointerInfo.startedOverUI;
            UIPointer pointer = WrapPointer(pointerInfo);
            UIPointer npt = new UIPointer
            {
                overUI = false,
                pointer = tp,
                overWaveLine = false,
                ray = m_Camera.ScreenPointToRay(tp.currentPosition)
            };
            //UIPointer pointer = WrapPointer(tp);
            // Do nothing if we're over UI
            if (pointer.overUI && hideWhenInvalid)
            if (npt.overUI && hideWhenInvalid)
            {
                m_CurrentTower.Hide();
                return;
            }
            MoveGhost(pointer, hideWhenInvalid);
            MoveGhost(npt, hideWhenInvalid);
        }
        /// <summary>
@@ -2473,6 +2497,8 @@
            state = State.Normal;
            m_Camera = GameObject.Find("SceneCamera3D").GetComponent<Camera>();
            //m_Camera = GameObject.Find("BackCamera").GetComponent<Camera>();
            //m_Camera = GetComponent<Camera>();
            TowerDestroyArr = new bool[5, AttackRowNumbers];
        }
@@ -2588,7 +2614,7 @@
            // WORK START: 从这里开始,移动的时候与场景内的WaveSelEffect射线做碰撞。  
            // Raycast onto placement layer
            PlacementAreaRaycast(ref npt);
            //Debug.Log("npt.raycast:" + npt.raycast);
            if (npt.raycast != null)
            {
                MoveGhostWithRaycastHit(npt.raycast.Value);
Assets/Scripts/TowerDefense/UI/HUD/PlacementTile.cs
@@ -56,6 +56,7 @@
        /// 可以放置的
        /// </summary>
        public Material canPlaceMat;
        public Material canNotPlaceMat;
        /// <summary>
        /// 放置在当前位置
@@ -197,6 +198,11 @@
        }
        public void SetWarning(bool isOn)
        {
            canPlaceRenderer.material = isOn ? canNotPlaceMat : canPlaceMat;
        }
        /// <summary>
        /// 塔的虚影
        /// </summary>
@@ -288,6 +294,11 @@
                        if (tileRenderer != null && openMat != null)
                            tileRenderer.sharedMaterial = openMat;
                    }
                    if (canPlaceRenderer.material == canNotPlaceMat)
                    {
                        SetWarning(false);
                    }
                    break;
                case PlacementGridType.EGridDestroyed:
                    if (tileRenderer != null && destroyedMat != null)
Assets/UI/Fight/范围错误.png
Assets/UI/Fight/范围错误.png.meta
New file
@@ -0,0 +1,94 @@
fileFormatVersion: 2
guid: 88b08067e1ff0d64fb74c916398dd462
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: