2025.9.25 minimap小地图

This commit is contained in:
kongweiqiang 2025-09-25 14:51:42 +08:00
parent 3f1618ff83
commit 89c8f158fc
3 changed files with 289 additions and 201 deletions

View File

@ -1732,9 +1732,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -105, y: 210}
m_SizeDelta: {x: 240, y: 590}
m_Pivot: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 280, y: 280}
m_Pivot: {x: 1, y: 1}
--- !u!114 &5083753519336987474
MonoBehaviour:
m_ObjectHideFlags: 0
@ -7575,8 +7575,8 @@ RectTransform:
m_GameObject: {fileID: 580195797562871363}
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_ConstrainProportionsScale: 0
m_LocalScale: {x: 0.7, y: 0.7, z: 0.7}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 5213810408001354677}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -10722,11 +10722,11 @@ RectTransform:
- {fileID: 5214553398721685030}
m_Father: {fileID: 4357504328262671953}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 104.8, y: -501}
m_SizeDelta: {x: 269.7, y: 40}
m_Pivot: {x: 1, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: -40}
m_SizeDelta: {x: 0, y: 40}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &6148461124210600139
MonoBehaviour:
m_ObjectHideFlags: 0
@ -11557,18 +11557,18 @@ RectTransform:
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_ConstrainProportionsScale: 0
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 3767939599513061667}
- {fileID: 5957034194288721546}
- {fileID: 1011196657756228559}
m_Father: {fileID: 4357504328262671953}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -236}
m_SizeDelta: {x: 156, y: 156}
m_Pivot: {x: 0.5, y: 1}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -14.5, y: 35.1}
m_SizeDelta: {x: 400, y: 400}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &245318573794112969
CanvasRenderer:
m_ObjectHideFlags: 0
@ -18250,10 +18250,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 5213810408001354677}
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_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 400, y: 400}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1739998026527562663
CanvasRenderer:
@ -37011,15 +37011,15 @@ RectTransform:
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_ConstrainProportionsScale: 0
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 4357504328262671953}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: -30.1, y: -204}
m_SizeDelta: {x: 280, y: 280}
m_Pivot: {x: 0.5, y: 1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 5, y: 5}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 1, y: 1}
--- !u!222 &6132386752254044156
CanvasRenderer:
m_ObjectHideFlags: 0

View File

@ -1,9 +1,9 @@
fileFormatVersion: 2
guid: f9a64b4be6c198c4ba59db859ac6a68b
TextureImporter:
fileIDToRecycleName: {}
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
@ -20,9 +20,12 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@ -31,12 +34,12 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: -1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
@ -46,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 4, y: 3, z: 4, w: 3}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@ -54,11 +57,17 @@ TextureImporter:
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
platformSettings:
- serializedVersion: 2
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
@ -68,8 +77,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
@ -79,8 +90,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
@ -90,8 +103,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
@ -101,8 +116,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
@ -112,7 +129,22 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
@ -120,13 +152,15 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 13e052c2a7c44b84286ae02a582a3916
internalID: -2021417472
vertices: []
indices:
edges: []
weights: []
spritePackingTag: BattlePageAtlas
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using LuaInterface;
using Mono.Xml;
using System.Linq;
public class BattleMgr : SingletonMono<BattleMgr>
{
@ -2037,14 +2038,19 @@ public class BattleMgr : SingletonMono<BattleMgr>
void WorldPos2MinimapPos(Vector3 pos, int mapSizeX, int mapSizeZ, int miniMapSizeX, int miniMapSizeZ, ref float x, ref float z)
{
/*
float xRate = pos.x / mapSizeX;
float zRate = pos.z / mapSizeZ;
x = miniMapSizeX * xRate;
z = miniMapSizeZ * zRate;
*/
}
public void RefreshMinimap(Vector3 center, int mapSizeX, int mapSizeZ, int miniMapSizeX, int miniMapSizeZ, GameObject hero, params RectTransform[] goes)
{
/*
GetFightersPos();
int cnt = mFightersPos.Count;
if (cnt < 2 || goes.Length < 1 || hero == null) return;
@ -2083,6 +2089,54 @@ public class BattleMgr : SingletonMono<BattleMgr>
goes[idx].anchoredPosition = p;
}
}
*/
//3d大地图尺寸140*140
//minimap ui尺寸280*280
//hero是箭头
//goes[0]是minimap其余是怪物
Vector3 player_pos = BattleMgr.Instance.Battle.FighterMgr.TeamFighters[0].Position;
Vector3 player_dir = BattleMgr.Instance.Battle.FighterMgr.TeamFighters[0].Forward;
//更新玩家go在小地图上的对应位置
RectTransform arrow = hero.gameObject.GetComponent<RectTransform>();
arrow.anchoredPosition = new Vector2(player_pos.x * 2f, player_pos.z * 2f);
//Debug.Log("player_pos:" + player_pos + " player_dir:" + player_dir);
//Debug.Log("hero.transform.position:" + hero.transform.position);
// 根据角色朝向更新小地图箭头的旋转
float angle = Mathf.Atan2(player_dir.x, player_dir.z) * Mathf.Rad2Deg;
arrow.localRotation = Quaternion.Euler(0, 0, -angle);
//设置怪物的位置GetFightersPos获取怪物go[0]不是怪物
GetFightersPos();
int cnt = mFightersPos.Count;
//Debug.Log("cnt:" + cnt);
if (cnt < 2 || goes.Length < 1 || hero == null) return;
for (int idx = 1; idx < goes.Length; idx++)
{
if (idx + 1 >= cnt)
{
goes[idx].gameObject.SetActive(false);
}
else
{
goes[idx].gameObject.SetActive(true);
Vector3 deltaPos = mFightersPos[idx + 1];
float enemyX = 0, enemyZ = 0;
//WorldPos2MinimapPos(deltaPos, mapSizeX, mapSizeZ, miniMapSizeX, miniMapSizeZ, ref enemyX, ref enemyZ);
enemyX = deltaPos.x * 2f;
enemyZ = deltaPos.z * 2f;
var p = goes[idx].anchoredPosition;
p.x = enemyX;
p.y = enemyZ;
goes[idx].anchoredPosition = p;
}
}
}
List<Vector3> mFightersPos = new List<Vector3>();