Merge branch 'AnHui_BaoShi' of http://git.zxkedu.com:33769/JiNan/VirtualFramework into AnHui_BaoShi

This commit is contained in:
李浩 2025-04-29 11:21:45 +08:00
commit 2ec900a23c
34 changed files with 344 additions and 16 deletions

View File

@ -643,7 +643,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.000007495649}
m_AnchoredPosition: {x: 0, y: 0.00026443074}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1181747651547168674
@ -1347,7 +1347,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &124795435256669180
RectTransform:
m_ObjectHideFlags: 0
@ -1437,10 +1437,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 3838833872239473580}
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: 100, y: 100}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3798398430471671831
CanvasRenderer:
@ -1470,7 +1470,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: cc9edef0c7d8eb54a84077129a9351a8, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -1890,7 +1890,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 6608813160943937009}
m_Direction: 2
m_Value: 0
m_Size: 1
m_Size: 0.99999845
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

View File

@ -0,0 +1,179 @@
fileFormatVersion: 2
guid: cc9edef0c7d8eb54a84077129a9351a8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 2
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 8192
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: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -423,4 +423,34 @@ public class Utility
list[j] = temp;
}
}
// 该方法用于打乱当前脚本所挂载物体的子物体顺序
public static void ShuffleChildObjects(Transform parent)
{
List<Transform> children = new List<Transform>();
for (int i = 0; i < parent.childCount; i++)
{
children.Add(parent.GetChild(i));
}
// 打乱子物体数组的顺序
for (int i = 0; i < children.Count; i++)
{
int randomIndex = UnityEngine.Random.Range(i, children.Count);
Transform temp = children[randomIndex];
children[randomIndex] = children[i];
children[i] = temp;
}
// 按照打乱后的顺序重新设置子物体的顺序
for (int i = 0; i < children.Count; i++)
{
children[i].SetSiblingIndex(i);
}
}
}

View File

@ -61,6 +61,14 @@ namespace QFramework
data.rightLabel = datas.ContainsKey("rightLabel") ? datas["rightLabel"] : "";
data.wrongLabel = datas.ContainsKey("wrongLabel") ? datas["wrongLabel"] : "";
data.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : "";
if (datas.ContainsKey("random"))
{
bool.TryParse(datas["random"], out data.random);
}
else
{
data.random = false;
}
foreach (var item in items)
{
@ -71,7 +79,7 @@ namespace QFramework
});
}
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data).ToAction().StartGlobal(() =>
{
this.Finish();

View File

@ -22,20 +22,30 @@ namespace QFramework.Example
public string rightLabel;
public string wrongLabel;
public string finishedEvent;
public bool random = false;
public List<OptionItem> items = new List<OptionItem>();
}
public partial class UIImageSelectMap : UIPanel
{
/// <summary>
/// ÓÒ²àÊý¾Ý½á¹¹
/// </summary>
class RightDataItem
{
public GameObject rightObj;
public bool isRight = false;
}
ResLoader loader;
GameObject moveObj;
GameObject enterRight;
GameObject leftDragObj;
Dictionary<GameObject, UIImageSelectMapData.OptionItem> itemDatas = new Dictionary<GameObject, UIImageSelectMapData.OptionItem>();
Dictionary<GameObject, GameObject> leftAndRightMap = new Dictionary<GameObject, GameObject>();
Dictionary<GameObject, RightDataItem> leftAndRightMap = new Dictionary<GameObject, RightDataItem>();
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitHandler);
// please add init code here
loader = ResLoader.Allocate();
}
@ -43,7 +53,6 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
LeftContent.RemoveAllChildren();
RightContent.RemoveAllChildren();
itemDatas.Clear();
@ -73,7 +82,10 @@ namespace QFramework.Example
rightObj.OnPointerExitEvent(RightOnExit);
rightObj.OnPointerClickEvent(RightOnClick);
}
if (mData.random)
{
Utility.ShuffleChildObjects(LeftContent);
}
loader.LoadAsync();
@ -81,12 +93,17 @@ namespace QFramework.Example
}
private void OnModuleQuitHandler(OnModuleQuit quit)
{
Hide();
}
private void RightOnClick(PointerEventData data)
{
Transform trans = data.pointerClick.transform;
if (leftAndRightMap.ContainsKey(trans.gameObject))
{
leftAndRightMap[trans.gameObject].SetActive(true);
leftAndRightMap[trans.gameObject].rightObj.SetActive(true);
trans.GetComponent<Image>().color = Color.white;
trans.Find("PicBg/Pic").GetComponent<Image>().color = new Color(1, 1, 1, 0);
@ -124,26 +141,51 @@ namespace QFramework.Example
if (enterRight && leftAndRightMap.ContainsKey(enterRight) == false)
{
TextMeshProUGUI nameText = enterRight.transform.Find("Name").GetComponent<TextMeshProUGUI>();
bool isRight = false;
if (enterRight.name == itemDatas[leftDragObj].pic)
{
nameText.color = Color.green;
isRight = true;
}
else
{
nameText.color = Color.red;
}
Image img = enterRight.transform.Find("PicBg/Pic").GetComponent<Image>();
img.sprite = moveObj.GetComponent<Image>().sprite;
img.color = Color.white;
nameText.text = itemDatas[leftDragObj].name;
leftAndRightMap.Add(enterRight, leftDragObj);
leftAndRightMap.Add(enterRight, new RightDataItem() { rightObj = leftDragObj, isRight = isRight });
leftDragObj.SetActive(false);
if (isRight && Check())
{
if (string.IsNullOrEmpty(mData.finishedEvent) == false)
{
StringEventSystem.Global.Send(mData.finishedEvent);
}
}
}
GameObject.Destroy(moveObj);
moveObj = null;
leftDragObj = null;
}
public bool Check()
{
foreach (var item in leftAndRightMap)
{
if (item.Value.isRight == false)
{
return false;
}
}
return leftAndRightMap.Count == mData.items.Count;
}
private void LeftOnDrag(PointerEventData data)
{
//data.pointerDrag.transform.position = Input.mousePosition;
@ -164,6 +206,7 @@ namespace QFramework.Example
protected override void OnClose()
{
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnModuleQuitHandler);
}
}
}

View File

@ -59,7 +59,7 @@ namespace QFramework.Example
SceneManager.sceneLoaded += OnLoadFinished;
});
});
if (string.IsNullOrEmpty(item.Icon)==false)
if (string.IsNullOrEmpty(item.Icon) == false)
{
var icon = obj.transform.Find("Icon").GetComponent<Image>();
var localImageUrl = Global.imagePath + item.Icon;
@ -129,7 +129,7 @@ namespace QFramework.Example
{
var machin = StateMachineController.Instance;
}
UIKit.OpenPanelAsync<UIRightTop>().ToAction().StartGlobal(() =>
UIKit.OpenPanelAsync<UIRightTop>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
{
TypeEventSystem.Global.Send<OnModuleStart>();

View File

@ -1713,6 +1713,11 @@ namespace XMLTool
{
act.args.Add("rightBg", rightBg.Value);
}
XAttribute random = action.Attribute("random");
if (random != null)
{
act.args.Add("random", random.Value);
}
foreach (var itemData in action.Elements("Item"))
{
act.items.Add(new ImageSelectMapAction.Item()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -14,13 +14,14 @@
<Enter>
<Action type="Sequence">
<Action type="ImageSelectMap"
random="false"
scoreName=""
totalScore=""
rightScore=""
wrongScore=""
rightLabel=""
wrongLabel=""
finishedEvent=""
finishedEvent="全部完成"
rightBg="baoshi/背景图.png">
<Item name="碧玺(红)" pic="baoshi/碧玺(红).png"></Item>
<Item name="玻璃猫眼(白)" pic="baoshi/玻璃猫眼(白).png"></Item>
@ -48,6 +49,13 @@
<Item name="紫晶" pic="baoshi/紫晶.png"></Item>
</Action>
<Condition type="StrEvent" value="全部完成"></Condition>
<Action type="TipWindow" value="恭喜你完成当前模块" btns="确定" audio=""></Action>
</Action>
</Enter>
</State>

View File

@ -7,5 +7,60 @@
<Type>All</Type>
<Name>玉石分类</Name>
<OnlyCurScore>true</OnlyCurScore>
<!--状态机-->
<FSM name="状态机1">
<State name="初始状态">
<Enter>
<Action type="Sequence">
<Action type="ImageSelectMap"
scoreName=""
totalScore=""
rightScore=""
wrongScore=""
rightLabel=""
wrongLabel=""
finishedEvent="全部完成"
rightBg="baoshi/背景图.png">
<Item name="碧玺(红)" pic="baoshi/碧玺(红).png"></Item>
<Item name="玻璃猫眼(白)" pic="baoshi/玻璃猫眼(白).png"></Item>
<Item name="查罗石" pic="baoshi/查罗石.png"></Item>
<Item name="发晶(无色)" pic="baoshi/发晶(无色).png"></Item>
<Item name="方柱石" pic="baoshi/方柱石.png"></Item>
<Item name="橄榄石" pic="baoshi/橄榄石.png"></Item>
<Item name="合成红宝石" pic="baoshi/合成红宝石.png"></Item>
<Item name="合成尖晶石" pic="baoshi/合成尖晶石.png"></Item>
<Item name="红玛瑙" pic="baoshi/红玛瑙.png"></Item>
<Item name="菱锰矿" pic="baoshi/菱锰矿.png"></Item>
<Item name="合成立方氧化锆" pic="baoshi/合成立方氧化锆.png"></Item>
<Item name="磷灰石" pic="baoshi/磷灰石.png"></Item>
<Item name="石英岩玉" pic="baoshi/石英岩玉.png"></Item>
<Item name="月光石(黄)" pic="baoshi/月光石(黄).png"></Item>
<Item name="合成蓝宝石" pic="baoshi/合成蓝宝石.png"></Item>
<Item name="托帕石" pic="baoshi/托帕石.png"></Item>
<Item name="玉髓(蓝)" pic="baoshi/玉髓(蓝).png"></Item>
<Item name="碧玺(绿)" pic="baoshi/碧玺(绿).png"></Item>
<Item name="合成祖母绿" pic="baoshi/合成祖母绿.png"></Item>
<Item name="和田玉(碧玉)" pic="baoshi/和田玉(碧玉).png"></Item>
<Item name="欧泊(白)" pic="baoshi/欧泊(白).png"></Item>
<Item name="月光石(白)" pic="baoshi/月光石(白).png"></Item>
<Item name="合成蓝宝石" pic="baoshi/合成蓝宝石.png"></Item>
<Item name="紫晶" pic="baoshi/紫晶.png"></Item>
</Action>
<Condition type="StrEvent" value="全部完成"></Condition>
<Action type="TipWindow" value="恭喜你完成当前模块" btns="确定" audio=""></Action>
</Action>
</Enter>
</State>
<Transision from="any" to="初始状态">
</Transision>
</FSM>
</Module>