Commit f3192eda authored by shujianhe's avatar shujianhe

1 缩放和移动后正常点击区域并逐渐填充,点击后气泡扩散暂未实现

parent a3463f7f
...@@ -794,6 +794,7 @@ GameObject: ...@@ -794,6 +794,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 593691933} - component: {fileID: 593691933}
- component: {fileID: 593691934}
m_Layer: 0 m_Layer: 0
m_Name: areaIdBase m_Name: areaIdBase
m_TagString: Untagged m_TagString: Untagged
...@@ -821,6 +822,51 @@ RectTransform: ...@@ -821,6 +822,51 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 950, y: 1280} m_SizeDelta: {x: 950, y: 1280}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!61 &593691934
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 593691932}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 950, y: 1280}
m_EdgeRadius: 0
--- !u!1 &706874198 --- !u!1 &706874198
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -897,142 +943,6 @@ CanvasRenderer: ...@@ -897,142 +943,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 706874198} m_GameObject: {fileID: 706874198}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &759592344
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 759592345}
- component: {fileID: 759592347}
- component: {fileID: 759592346}
m_Layer: 0
m_Name: debugView
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &759592345
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 759592344}
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_Children: []
m_Father: {fileID: 1474894691}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -5.9033203, y: -1559.2}
m_SizeDelta: {x: -74.776, y: 136.63}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &759592346
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 759592344}
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: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: this is a testtextxfx zdfzsdfdsfdsfdsfffffffff ffffffffffffff ffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffff5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffssssssssssssssssssssssssssssssssssssffffffhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4287981311
m_fontColor: {r: 1, g: 0.40060285, b: 0.58431375, 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: 2
m_VerticalAlignment: 512
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: 3
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: 0
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}
--- !u!222 &759592347
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 759592344}
m_CullTransparentMesh: 1
--- !u!1 &859724157 --- !u!1 &859724157
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1536,7 +1446,6 @@ RectTransform: ...@@ -1536,7 +1446,6 @@ RectTransform:
- {fileID: 1656126341} - {fileID: 1656126341}
- {fileID: 1013381886} - {fileID: 1013381886}
- {fileID: 133508485} - {fileID: 133508485}
- {fileID: 759592345}
m_Father: {fileID: 297775248} m_Father: {fileID: 297775248}
m_RootOrder: -1 m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -1761,6 +1670,7 @@ MonoBehaviour: ...@@ -1761,6 +1670,7 @@ MonoBehaviour:
lowImg: {fileID: 303685715} lowImg: {fileID: 303685715}
areaIdBase: {fileID: 593691932} areaIdBase: {fileID: 593691932}
perfabPath: perfabs/areaGroupId perfabPath: perfabs/areaGroupId
lowImgTexture2ds: []
--- !u!114 &1656126344 --- !u!114 &1656126344
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1780,7 +1690,9 @@ MonoBehaviour: ...@@ -1780,7 +1690,9 @@ MonoBehaviour:
- {fileID: 1893464095} - {fileID: 1893464095}
- {fileID: 1755905471} - {fileID: 1755905471}
- {fileID: 133508484} - {fileID: 133508484}
- {fileID: 759592344} - {fileID: 0}
- {fileID: 0}
DebugSprites: []
--- !u!222 &1656126346 --- !u!222 &1656126346
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -2085,7 +1997,7 @@ MonoBehaviour: ...@@ -2085,7 +1997,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 1977147924} m_HandleRect: {fileID: 1977147924}
m_Direction: 0 m_Direction: 0
m_Value: 1 m_Value: 1
m_Size: 1 m_Size: 0.9999999
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
......
...@@ -5,11 +5,22 @@ using UnityEngine; ...@@ -5,11 +5,22 @@ using UnityEngine;
[System.Serializable] [System.Serializable]
public class gameAreaGroupItem public class gameAreaGroupItem
{ {
public double gid; public short id;
public List<short> areaIds; public List<short> roomIds;
public List<UInt16> RGB; public float R;
public float G;
public float B;
public bool isComplete = false;
public void getRGB(out Color color) public void getRGB(out Color color)
{ {
color = new Color(RGB[0] / 255, RGB[1] / 255, RGB[2] / 255, 1); color = new Color(R / 255f, G / 255f, B / 255f, 1);
}
public static int sortByIsComplete(gameAreaGroupItem a, gameAreaGroupItem b)
{
if(a.isComplete == b.isComplete)
{
return a.id - b.id;
}
return a.isComplete ? 1 : -1;
} }
} }
...@@ -5,9 +5,17 @@ using UnityEngine; ...@@ -5,9 +5,17 @@ using UnityEngine;
[System.Serializable] [System.Serializable]
public class gameAreaItem public class gameAreaItem
{ {
public short x; public short px;
public short y; public short py;
public ushort id; public short pr;
public short gid; public float R;
public float G;
public float B;
public short id;
public short gid = -1;//组id
public short valid;//未知含义 未启用
public short useAreaData;//未知含义 未启用
public bool notPaintCol;//未启用
public string tempExKey = ""; public string tempExKey = "";
public bool isShow = false;
} }
...@@ -7,6 +7,6 @@ public class gameIdJsonData ...@@ -7,6 +7,6 @@ public class gameIdJsonData
public string nowId = ""; public string nowId = "";
public short width = 0; public short width = 0;
public short height = 0; public short height = 0;
public List<gameAreaItem> centers = new List<gameAreaItem>(); public List<gameAreaItem> roomDatas = new List<gameAreaItem>();
public List<gameAreaGroupItem> groups = new List<gameAreaGroupItem>(); public List<gameAreaGroupItem> roomGroupsData = new List<gameAreaGroupItem>();
} }
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro; using TMPro;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class gameSceneLogic : MonoBehaviour, IEventHandler public class gameSceneLogic : MonoBehaviour, IEventHandler
{ {
...@@ -10,58 +12,51 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -10,58 +12,51 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
public GameObject gameShowView = null; public GameObject gameShowView = null;
public GameObject areaGroupList = null; public GameObject areaGroupList = null;
public static int maxIdValue = 100; public static int maxIdValue = 100;
private int nowSelectGroupId = 4; private int nowidx = 4;
public float progress = 0; public float progress = 0;
public bool showAreaId = true; public bool showAreaId = true;
private TextMeshProUGUI debugViewObj = null; private TextMeshProUGUI debugViewObj = null;
private List<TempGroupInfos> groupInfos = null;
private Vector2 pos1 = new Vector2(-10000, -10000);
private int rvalue = -1;
void Start() void Start()
{ {
//GetComponent<TextMeshProUGUI>() //GetComponent<TextMeshProUGUI>()
utilsTools.onEvent(this, "switchGameAreaGroupId"); utilsTools.onEvent(this, "switchGameAreaGroupId");
utilsTools.onEvent(this, "gameViewOnInitEnd"); utilsTools.onEvent(this, "gameViewOnInitEnd");
utilsTools.onEvent(this, "debugViewLogHandler"); utilsTools.onEvent(this, "gameClickPos");
var debugTran = transform.Find("debugView");
if(debugTran != null)
{
debugViewObj = debugTran.GetComponent<TextMeshProUGUI>();
if (debugViewObj == null) debugTran.gameObject.SetActive(false);
else
{
debugTran.gameObject.SetActive(utilsTools.IsPhone);
}
}
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>(); var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
gridViewList.gameObject.SetActive(true); gridViewList.gameObject.SetActive(false);
gameShowView.GetComponent<mainGameView>().loadTest(); gameShowView.GetComponent<mainGameView>().loadTest();
//gridViewList.setDataNoGrid(20, 150, 150, 15, (GameObject gobject, int idx, ListViewBackTypeEnum lvbType) =>
//{
// if (lvbType == ListViewBackTypeEnum.create || ListViewBackTypeEnum.update == lvbType)
// {
// var item = gobject.GetComponent<colorItem>();
// bool isSelect = idx == nowSelectGroupId;
// item.IsSelect = isSelect;
// Vector3 vector3;
// Quaternion quaternion;
// gobject.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
// vector3.y = -95f;
// if (isSelect)
// {
// vector3.y = vector3.y + 14;
// }
// gobject.transform.SetLocalPositionAndRotation(vector3, quaternion);
// item.IdName = idx.ToString();
// float idxf = idx;
// item.UseColor = new Color(idxf * 10 / 255f, 0.5f, (22 - idxf) * 10 / 255f, 1.0f);
// item.NowProgress = idx < 4 ? 0.0f : (idx < 15 ? idx / 13f : 1.0f);
// }
//}, false);
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
} }
private void onUpdateGroupGridHandler(GameObject gobject, int idx, ListViewBackTypeEnum lvbType,TempGroupInfos group)
{
if (lvbType == ListViewBackTypeEnum.create || ListViewBackTypeEnum.update == lvbType)
{
var item = gobject.GetComponent<colorItem>();
bool isSelect = idx == nowidx;
item.IsSelect = isSelect;
Vector3 vector3;
Quaternion quaternion;
gobject.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = -95f;
if (isSelect)
{
vector3.y = vector3.y + 14;
}
gobject.transform.SetLocalPositionAndRotation(vector3, quaternion);
item.IdName = (group.gid).ToString();
item.index = idx;
item.UseColor = group.rgb;
item.NowProgress = group.jindu;
}
}
public void onEventHandler(string eventName, List<UnityEngine.Object> uobjects, List<System.Object> objects) public void onEventHandler(string eventName, List<UnityEngine.Object> uobjects, List<System.Object> objects)
{ {
if (eventName.Equals("switchGameAreaGroupId")) if (eventName.Equals("switchGameAreaGroupId"))
...@@ -70,94 +65,68 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler ...@@ -70,94 +65,68 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
Quaternion quaternion; Quaternion quaternion;
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>(); var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
colorItem item = null; colorItem item = null;
if (nowSelectGroupId >= 0) if (nowidx >= 0)
{ {
item = gridViewList.getObjectById(nowSelectGroupId).GetComponent<colorItem>(); item = gridViewList.getObjectById(nowidx).GetComponent<colorItem>();
item.IsSelect = false; item.IsSelect = false;
item.transform.GetLocalPositionAndRotation(out vector3, out quaternion); item.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = vector3.y - 14; vector3.y = vector3.y - 14;
item.transform.SetLocalPositionAndRotation(vector3, quaternion); item.transform.SetLocalPositionAndRotation(vector3, quaternion);
} }
var maingameView = gameShowView.GetComponent<mainGameView>(); var maingameView = gameShowView.GetComponent<mainGameView>();
nowSelectGroupId = (int)objects[0]; int idx = (int)objects[0];
item = gridViewList.getObjectById(nowSelectGroupId).GetComponent<colorItem>(); nowidx = idx;
var nowSelectGroupId = groupInfos[idx].gid;
item = gridViewList.getObjectById(idx).GetComponent<colorItem>();
item.IsSelect = true; item.IsSelect = true;
item.transform.GetLocalPositionAndRotation(out vector3, out quaternion); item.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = vector3.y + 14; vector3.y = vector3.y + 14;
item.transform.SetLocalPositionAndRotation(vector3, quaternion); item.transform.SetLocalPositionAndRotation(vector3, quaternion);
print("切换下表开始" + nowSelectGroupId.ToString()); Debug.Log("切换下标开始" + nowSelectGroupId.ToString());
maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => { maingameView.switchShowAreaGroup((short)nowSelectGroupId, (int id, bool isOk) => {
print("切换下表完成" + id.ToString()); Debug.Log("切换下标完成" + id.ToString());
}); });
}else if (eventName.Equals("gameViewOnInitEnd")) }else if (eventName.Equals("gameViewOnInitEnd"))
{ {
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>(); var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
gridViewList.gameObject.SetActive(true); gridViewList.gameObject.SetActive(true);
var maingameView = gameShowView.GetComponent<mainGameView>(); var maingameView = gameShowView.GetComponent<mainGameView>();
var ColorInfos = maingameView.getGroups(); groupInfos = maingameView.getGroups();
gridViewList.setDataNoGrid(ColorInfos.Count, 150, 150, 20, (GameObject gobject, int idx, ListViewBackTypeEnum lvbType) => int cout = 0;
for (int i = 0; i < groupInfos.Count; i++)
{ {
if (lvbType == ListViewBackTypeEnum.create || ListViewBackTypeEnum.update == lvbType) if(groupInfos[i].jindu == 1) {
{ break;
var item = gobject.GetComponent<colorItem>();
bool isSelect = idx == nowSelectGroupId;
item.IsSelect = isSelect;
Vector3 vector3;
Quaternion quaternion;
gobject.transform.GetLocalPositionAndRotation(out vector3, out quaternion);
vector3.y = -95f;
if (isSelect)
{
vector3.y = vector3.y + 14;
}
gobject.transform.SetLocalPositionAndRotation(vector3, quaternion);
item.IdName = (idx + 1).ToString();
item.index = idx;
float idxf = idx;
item.UseColor = new Color(idxf * 10 / 255f, 0.5f, (22 - idxf) * 10 / 255f, 1.0f);
item.NowProgress = 0;
} }
cout++;
}
gridViewList.setDataNoGrid(cout, 150, 150, 20, (GameObject gobject, int idx, ListViewBackTypeEnum lvbType) =>
{
this.onUpdateGroupGridHandler(gobject, idx, lvbType, groupInfos[idx]);
}, false); }, false);
if(nowSelectGroupId > 0) if(nowidx > 0)
{ {
print("切换下表开始" + nowSelectGroupId.ToString()); //Debug.Log("切换下标开始" + nowSelectGroupId.ToString());
maingameView.switchShowAreaGroup((short)(nowSelectGroupId), (int id,bool isOk) => { maingameView.switchShowAreaGroup((short)(groupInfos[nowidx].gid), (int id,bool isOk) => {
print("切换下表完成" + id.ToString()); Debug.Log("切换下标完成" + id.ToString());
}); });
} }
}else if (eventName.Equals("debugViewLogHandler")) }else if (eventName.Equals("gameClickPos"))
{ {
string s = ""; short x = (short)objects[0];
if (objects != null) short y = (short)objects[1];
{ var maingameView = gameShowView.GetComponent<mainGameView>();
for (int i = 0; i < objects.Count; i++) maingameView.showAreaByPos(x,y, (int id,bool isOk) => {
{ Debug.Log("点击区域" + id.ToSafeString() + " 显示" + isOk.ToSafeString());
s = s + objects[i].ToString() + ","; return;
} });
} //groupInfos = maingameView.getGroups();
if(uobjects != null)
{
for (int i = 0; i < uobjects.Count; i++)
{
s = s + uobjects[i].ToString() + ",";
}
}
if (s.Length == 0) return;
print(s);
//if (utilsTools.IsPhone == false || debugViewObj == null)
//{
// print(s);
//}
//else
//{
// debugViewObj.text = s;
//}
} }
} }
public void onTestTemp1() public void onTestTemp1()
{ {
print("是否卡顿?"); Debug.Log("---->>>");
} }
} }
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.Assertions;
public class gameUserInfos : MonoBehaviour, IEventHandler public class gameUserInfos : MonoBehaviour, IEventHandler
{ {
...@@ -17,16 +19,21 @@ public class gameUserInfos : MonoBehaviour, IEventHandler ...@@ -17,16 +19,21 @@ public class gameUserInfos : MonoBehaviour, IEventHandler
} }
public void startId(string id) public void startId(string id)
{ {
gameSaveKey = "gameUserData_" + id.ToString(); GameScenUserInfo gameScenUser = utilsTools.getGameScenUserInfo(id);
string defvalue = ""; if(gameScenUser == null)
string oldGameInfo = utilsDB.getDBJsonDataByKey(gameSaveKey, defvalue);
if (oldGameInfo.Equals(defvalue))
{ {
return;
} }
List<short> shorts = new List<short>();
for (int i = 0; i < gameScenUser.areaInfoUseData.Count; i++)
{
shorts.Add(gameScenUser.areaInfoUseData[i].id);
}
GetComponent<mainGameView>().loadGameImgId(gameScenUser.img, gameScenUser.finishImg, gameScenUser.json,"",shorts);
} }
void IEventHandler.onEventHandler(string eventName, List<UnityEngine.Object> uobjects, List<System.Object> objects) void IEventHandler.onEventHandler(string eventName, List<UnityEngine.Object> uobjects, List<System.Object> objects)
{ {
} }
} }
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
delegate void CheckInput(); delegate void CheckInput();
public class mainGameScaleMove : MonoBehaviour public class mainGameScaleMove : MonoBehaviour
{ {
...@@ -14,10 +17,11 @@ public class mainGameScaleMove : MonoBehaviour ...@@ -14,10 +17,11 @@ public class mainGameScaleMove : MonoBehaviour
private bool skipDoubleScale = false; private bool skipDoubleScale = false;
public float OldTouchCurrDis = -1000; public float OldTouchCurrDis = -1000;
public float minScale = 0.25f; public float minScale = 0.25f;
public float maxScale = 8f; public float maxScale = 1.25f;//8f;
public List<GameObject> ignoreList = new List<GameObject>(); public List<GameObject> ignoreList = new List<GameObject>();
private List<System.Object> logTempList = null; private List<System.Object> logTempList = null;
private Vector2 winPrvePos = new Vector2(-90000, -90000); private Vector2 winPrvePos = new Vector2(-90000, -90000);
public List<Sprite> DebugSprites = new List<Sprite>();
public Vector2 NowPos public Vector2 NowPos
{ {
get { return nowPos; } get { return nowPos; }
...@@ -89,18 +93,18 @@ public class mainGameScaleMove : MonoBehaviour ...@@ -89,18 +93,18 @@ public class mainGameScaleMove : MonoBehaviour
TouchPhase touchPhase = oneTouch.phase; TouchPhase touchPhase = oneTouch.phase;
if(touchPhase == TouchPhase.Began) if(touchPhase == TouchPhase.Began)
{ {
MyPrint("one Click begin"); Debug.Log("one Click begin");
onOneTouchBegin(oneTouch.position); onOneTouchBegin(oneTouch.position);
} }
else if(touchPhase == TouchPhase.Moved) else if(touchPhase == TouchPhase.Moved)
{ {
if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false) return; if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false) return;
MyPrint("one Click move"); Debug.Log("one Click move");
onOneTouchMove(oneTouch.position, oneTouch.deltaPosition); onOneTouchMove(oneTouch.position, oneTouch.deltaPosition);
}else if(touchPhase == TouchPhase.Ended) }else if(touchPhase == TouchPhase.Ended)
{ {
if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false) return; if (utilsTools.ContainsKey(gameObject, "oneTouchBegin") == false) return;
MyPrint("one Click end"); Debug.Log("one Click end");
onOneTouchEnd(oneTouch.position, oneTouch.deltaPosition); onOneTouchEnd(oneTouch.position, oneTouch.deltaPosition);
}else if(touchPhase == TouchPhase.Canceled) }else if(touchPhase == TouchPhase.Canceled)
{ {
...@@ -138,25 +142,24 @@ public class mainGameScaleMove : MonoBehaviour ...@@ -138,25 +142,24 @@ public class mainGameScaleMove : MonoBehaviour
var itemChild = transform.GetChild(i); var itemChild = transform.GetChild(i);
itemChild.localScale = nowScale; itemChild.localScale = nowScale;
} }
MyPrint("scale", "", nowScale, nowSize);
} }
void clearOneTouchBegin() void clearOneTouchBegin()
{ {
MyPrint("one Click clear"); Debug.Log("one Click clear");
utilsTools.delUserDataByKey(gameObject, "oneTouchBegin"); utilsTools.delUserDataByKey(gameObject, "oneTouchBegin");
} }
bool checkMouseInIgnoreList(Vector2 vector) bool checkMouseInIgnoreList(Vector2 vector)
{ {
for (int i = 0; i < ignoreList.Count; i++) for (int i = 0; i < ignoreList.Count; i++)
{ {
if (ignoreList[i] == null) continue;
RectTransform checkRectTransform = ignoreList[i].transform.GetComponent<RectTransform>(); RectTransform checkRectTransform = ignoreList[i].transform.GetComponent<RectTransform>();
var newLocalPos = utilsTools.ScreenToUILocalPos(checkRectTransform, vector); var newLocalPos = utilsTools.ScreenToUILocalPos(checkRectTransform, vector);
if (checkRectTransform.rect.Contains(newLocalPos)) return true; if (checkRectTransform.rect.Contains(newLocalPos)) return true;
} }
return false; return false;
} }
//左键点击 右键缩放 //左键点击 右键缩放
void checkInputByComputer() void checkInputByComputer()
{ {
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0))
...@@ -212,85 +215,91 @@ public class mainGameScaleMove : MonoBehaviour ...@@ -212,85 +215,91 @@ public class mainGameScaleMove : MonoBehaviour
{ {
delatPos.y = 0; delatPos.y = 0;
} }
if (delatPos.x == delatPos.y && delatPos.x == 0) return;//都不用移动就不更新坐标 if (delatPos.x == delatPos.y && delatPos.x == 0) return;//都不用移动就不更新坐标
tempVector3.x += delatPos.x; tempVector3.x += delatPos.x;
tempVector3.y += delatPos.y; tempVector3.y += delatPos.y;
MyPrint("move", tempVector3, nowScale, nowSize); Debug.Log("move"+tempVector3.ToSafeString()+ nowScale.ToSafeString()+ nowSize.ToSafeString());
} }
itemChild.SetLocalPositionAndRotation(tempVector3, quaternion); itemChild.SetLocalPositionAndRotation(tempVector3, quaternion);
} }
//更新坐标 应该记录当前显示的位置 //更新坐标 应该记录当前显示的位置
}
private void MyPrint(System.Object param1,System.Object param2 = null,System.Object param3 = null,System.Object param4 = null)
{
logTempList[0] = param1;
if (param2 == null) logTempList[1] = "";
else logTempList[1] = param2;
if (param3 == null) logTempList[2] = "";
else logTempList[1] = param3;
if (param4 == null) logTempList[3] = "";
else logTempList[1] = param4;
utilsTools.sendEventObjects("debugViewLogHandler", logTempList);
} }
private void onOneTouchEnd(Vector2 nowPos, Vector2 delatPos) private void onOneTouchEnd(Vector2 nowPos, Vector2 delatPos)
{ {
utilsTools.getUserData<Vector2>(gameObject, "oneTouchBegin", out tempVector, defvalueVector); utilsTools.getUserData<Vector2>(gameObject, "oneTouchBegin", out tempVector, defvalueVector);
if (tempVector.Equals(defvalueVector))//说明之前已经移除了 if (tempVector.Equals(defvalueVector))//说明之前已经移除了
{ {
return; return;
} }
float sqrMagnitude = (nowPos - tempVector).SqrMagnitude(); float sqrMagnitude = (nowPos - tempVector).SqrMagnitude();
clearOneTouchBegin(); clearOneTouchBegin();
if (sqrMagnitude > 20f) {//按下和抬起距离太远就不算点击 if (sqrMagnitude > 20f) {//按下和抬起距离太远就不算点击
MyPrint("begin end diff big ", sqrMagnitude); Debug.Log("begin end diff big "+ sqrMagnitude);
return; return;
} }
onOneClick(nowPos); onOneClick(nowPos);
} }
//获取图片和屏幕交集的区域 //屏幕坐标系 //获取图片和屏幕交集的区域 //屏幕坐标系
Rect ImageToSceneJiao() Rect ImageToSceneJiao()
{ {
//将四个点转成屏幕坐标系 //将四个点转成屏幕坐标系
RectTransform firstRectTransform = transform.GetChild(0).GetComponent<RectTransform>(); RectTransform firstRectTransform = transform.GetChild(0).GetComponent<RectTransform>();
Rect rect = firstRectTransform.rect; Rect rect = firstRectTransform.rect;
//Vector2 localtemp;
//Vector2 worldtemp;
//Vector2 pingtemp;
//Vector2 pingtemp2;
//localtemp = new Vector2(rect.xMin, rect.yMin);
//worldtemp = firstRectTransform.TransformPoint(localtemp);
//pingtemp = Camera.main.WorldToScreenPoint(worldtemp);
//MyPrint(localtemp, worldtemp, pingtemp);
//localtemp = new Vector2(rect.xMax, rect.yMax);
//worldtemp = firstRectTransform.TransformPoint(localtemp);
//pingtemp2 = Camera.main.WorldToScreenPoint(worldtemp);
//Rect wuti = new Rect(pingtemp.x, pingtemp.y, pingtemp2.x, pingtemp2.y);
//Rect pingRect = new Rect(0, 0, utilsTools.DisplaySize.x, utilsTools.DisplaySize.y);
//Rect ret = new Rect(0, 0, 0, 0);
//if (wuti.x < pingRect.x)
// ret.x = pingRect.x;
//else
// ret.x = wuti.x;
//if (wuti.y < pingRect.y)
// ret.y = pingRect.y;
//MyPrint(localtemp, worldtemp, pingtemp);
return rect; return rect;
} }
private Vector3 GetNativePosition(Vector3 screenPos)
{
// 将屏幕坐标转换为世界坐标
screenPos.z = 10000f;
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Ray2D ray = new Ray2D(worldPos, Vector2.right);
RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);
if(hit.collider != null)
{
Debug.Log("有碰撞 ....");
}
else
{
Debug.Log("没有碰撞 ");
}
// 获取节点的缩放信息
Vector3 scale = transform.localScale;
// 获取节点的位置信息
Vector3 position = transform.localPosition;
// 计算节点的逆变换矩阵
Matrix4x4 inverseTransform = Matrix4x4.TRS(-position, Quaternion.identity, Vector3.one).inverse;
inverseTransform *= Matrix4x4.Scale(new Vector3(1 / scale.x, 1 / scale.y, 1 / scale.z));
// 将世界坐标转换为节点内的原生坐标
Vector3 nativePos = inverseTransform.MultiplyPoint(worldPos);
return nativePos;
}
private void onOneClick(Vector2 nowPos) private void onOneClick(Vector2 nowPos)
{ {
RectTransform firstRectTransform = transform.GetChild(0).GetComponent<RectTransform>(); Vector3 temp = new Vector3(nowPos.x,nowPos.y);
var localPos = utilsTools.ScreenToUILocalPos(firstRectTransform, nowPos); mainGameView mainView = GetComponent<mainGameView>();
if (firstRectTransform.rect.Contains(localPos))//首先要区域内 int width;
int height;
if (mainView.getSize(out width, out height) == false) return;
var lineTransform = transform.Find("low").GetComponent<RectTransform>();
Vector2 vector = utilsTools.ScreenToUILocalPos(lineTransform, nowPos);
if (lineTransform.rect.Contains(vector))
{ {
Vector2 localPos1 = (localPos - (nowPos * nowScale * 3f)); Vector2 scaleVector = new Vector2(width / lineTransform.rect.width, height / lineTransform.rect.height);
MyPrint("click", nowPos, localPos, localPos1); Vector2 pos1 = vector * scaleVector;
short x = Convert.ToInt16(pos1.x + width / 2);
short y = Convert.ToInt16(pos1.y + height / 2);
List<System.Object> senddata = new List<System.Object>() {x,y};
utilsTools.sendEventObjects("gameClickPos", senddata);
} }
else else
{ {
MyPrint("click", nowPos, localPos, "noRect"); print("2");
} }
//nowPos = GetNativePosition(temp);
//Debug.Log("当前点击位置到图片对应"+temp.ToSafeString());
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
......
This diff is collapsed.
...@@ -118,7 +118,7 @@ public class nodeNetProxy : MonoBehaviour ...@@ -118,7 +118,7 @@ public class nodeNetProxy : MonoBehaviour
{ {
if (request.isNetworkError || request.isHttpError) //���������󣬻��ߵ�ַ���� if (request.isNetworkError || request.isHttpError) //���������󣬻��ߵ�ַ����
{ {
print("error" + request.error + url); //���������� Debug.Log("error" + request.error + url); //����������
back("", wurl, false, null); back("", wurl, false, null);
} }
else //���û�� else //���û��
...@@ -138,16 +138,16 @@ public class nodeNetProxy : MonoBehaviour ...@@ -138,16 +138,16 @@ public class nodeNetProxy : MonoBehaviour
//��������Ѿ���� //��������Ѿ����
if (request.isDone) if (request.isDone)
{ {
print("load end " + url); Debug.Log("load end " + url);
if (request.isNetworkError || request.isHttpError) //���������󣬻��ߵ�ַ���� if (request.isNetworkError || request.isHttpError) //���������󣬻��ߵ�ַ����
{ {
print(request.error); //���������� Debug.Log(request.error); //����������
back("", wurl, false, null); back("", wurl, false, null);
} }
else //���û�� else //���û��
{ {
print("load end ok " + url); Debug.Log("load end ok " + url);
String data1 = DownloadHandlerBuffer.GetContent(request); String data1 = DownloadHandlerBuffer.GetContent(request);
back("", wurl, true, data1); back("", wurl, true, data1);
} }
...@@ -164,7 +164,7 @@ public class nodeNetProxy : MonoBehaviour ...@@ -164,7 +164,7 @@ public class nodeNetProxy : MonoBehaviour
} }
else else
{ {
print("jar:file://" + abspath); Debug.Log("jar:file://" + abspath);
StartCoroutine(loadLocalTextFileData("jar:file://" + abspath, url, back)); StartCoroutine(loadLocalTextFileData("jar:file://" + abspath, url, back));
} }
...@@ -204,7 +204,7 @@ public class nodeNetProxy : MonoBehaviour ...@@ -204,7 +204,7 @@ public class nodeNetProxy : MonoBehaviour
StartCoroutine(loadLocalFileData("file://" + abspath, url, back)); StartCoroutine(loadLocalFileData("file://" + abspath, url, back));
else else
{ {
print("jar:file://" + abspath); Debug.Log("jar:file://" + abspath);
StartCoroutine(loadLocalFileData("jar:file://" + abspath, url, back)); StartCoroutine(loadLocalFileData("jar:file://" + abspath, url, back));
} }
return; return;
...@@ -214,8 +214,8 @@ public class nodeNetProxy : MonoBehaviour ...@@ -214,8 +214,8 @@ public class nodeNetProxy : MonoBehaviour
back("", url, false, null); back("", url, false, null);
return; return;
} }
print("no find path " + localpath + " >> " + abspath); Debug.Log("no find path " + localpath + " >> " + abspath);
print(url); Debug.Log(url);
nodeNetProxyItem newItem = new nodeNetProxyItem(); nodeNetProxyItem newItem = new nodeNetProxyItem();
newItem.url = url; newItem.url = url;
newItem.back = back; newItem.back = back;
...@@ -235,9 +235,9 @@ public class nodeNetProxy : MonoBehaviour ...@@ -235,9 +235,9 @@ public class nodeNetProxy : MonoBehaviour
yield return unityWebRequest.SendWebRequest(); yield return unityWebRequest.SendWebRequest();
if (unityWebRequest.error != null) if (unityWebRequest.error != null)
{ {
print("DonLoadText error"); Debug.Log("DonLoadText error");
print(unityWebRequest.error); Debug.Log(unityWebRequest.error);
print(unityWebRequest.ToString()); Debug.Log(unityWebRequest.ToString());
item.back("", url, false, null); item.back("", url, false, null);
yield return unityWebRequest; yield return unityWebRequest;
} }
...@@ -288,8 +288,17 @@ public class nodeNetProxy : MonoBehaviour ...@@ -288,8 +288,17 @@ public class nodeNetProxy : MonoBehaviour
string path1 = path; string path1 = path;
string expath = Path.GetExtension(path1); string expath = Path.GetExtension(path1);
path1 = path1.Substring(0, path1.Length - expath.Length); path1 = path1.Substring(0, path1.Length - expath.Length);
print(path1); if (utilsTools.IsPhone == false)
item.back("", url, true, Resources.Load<Texture>(path1)); StartCoroutine(loadLocalFileData("file://" + path1, url, item.back));
else
{
Debug.Log("jar:file://" + path1);
StartCoroutine(loadLocalFileData("jar:file://" + path1, url, item.back));
}
//Debug.Log(path1);
//var texture = Resources.Load<Texture>(path1);
//item.back("", url, true, texture);
} }
yield return null; yield return null;
......
...@@ -59,8 +59,8 @@ public class MouseDragSelect : MonoBehaviour ...@@ -59,8 +59,8 @@ public class MouseDragSelect : MonoBehaviour
if (!draggingMouse) if (!draggingMouse)
{ {
mousePositions[0] = Input.mousePosition; mousePositions[0] = Input.mousePosition;
print("x start:" + mousePositions[0].x); Debug.Log("x start:" + mousePositions[0].x);
print("y start:" + mousePositions[0].y); Debug.Log("y start:" + mousePositions[0].y);
} }
draggingMouse = true; draggingMouse = true;
} }
...@@ -73,12 +73,12 @@ public class MouseDragSelect : MonoBehaviour ...@@ -73,12 +73,12 @@ public class MouseDragSelect : MonoBehaviour
float height = Math.Abs(mousePositions[1].y - mousePositions[0].y); float height = Math.Abs(mousePositions[1].y - mousePositions[0].y);
float x = mousePositions[0].x; float x = mousePositions[0].x;
float y = mousePositions[0].y; float y = mousePositions[0].y;
// print("width:" + width); // Debug.Log("width:" + width);
// print("height:" + height); // Debug.Log("height:" + height);
print("x end:" + mousePositions[1].x); Debug.Log("x end:" + mousePositions[1].x);
print("y end:" + mousePositions[1].y); Debug.Log("y end:" + mousePositions[1].y);
position = new Rect(x, y, width, height); position = new Rect(x, y, width, height);
// print("Got last mouse position!"); // Debug.Log("Got last mouse position!");
drawRect = true; drawRect = true;
} }
} }
......
...@@ -77,7 +77,7 @@ public class tempzhangs : MonoBehaviour ...@@ -77,7 +77,7 @@ public class tempzhangs : MonoBehaviour
////void clearFlgs(int startx, int starty, int w, int h, short val) ////void clearFlgs(int startx, int starty, int w, int h, short val)
////{ ////{
//// Color tempColor = new Color(); //// Color tempColor = new Color();
//// print("开始尝试循环赋值"); //// Debug.Log("开始尝试循环赋值");
//// int nobai = 0; //// int nobai = 0;
//// for (int i = 0; i < clickTexture2D.width; i++) //// for (int i = 0; i < clickTexture2D.width; i++)
//// { //// {
...@@ -104,7 +104,7 @@ public class tempzhangs : MonoBehaviour ...@@ -104,7 +104,7 @@ public class tempzhangs : MonoBehaviour
//// setColor(i, j, tempColor); //// setColor(i, j, tempColor);
//// } //// }
//// } //// }
//// print("结束循环赋值 nobai = " + nobai); //// Debug.Log("结束循环赋值 nobai = " + nobai);
//// updateUIMask(); //// updateUIMask();
////} ////}
////void clearAllData() ////void clearAllData()
...@@ -136,7 +136,7 @@ public class tempzhangs : MonoBehaviour ...@@ -136,7 +136,7 @@ public class tempzhangs : MonoBehaviour
////private void CaculateVector2(int x, int y) ////private void CaculateVector2(int x, int y)
////{ ////{
//// if (dm.Data[x, y] != 1) return; //// if (dm.Data[x, y] != 1) return;
//// print("开始绘制圆形"); //// Debug.Log("开始绘制圆形");
//// operColorSize = 0; //// operColorSize = 0;
//// lastOperX = -1; //// lastOperX = -1;
//// dm.FloodFill8WithStack((short)x, (short)y, -100, 1, (short x1, short y1, short value) => //// dm.FloodFill8WithStack((short)x, (short)y, -100, 1, (short x1, short y1, short value) =>
...@@ -154,7 +154,7 @@ public class tempzhangs : MonoBehaviour ...@@ -154,7 +154,7 @@ public class tempzhangs : MonoBehaviour
////} ////}
////private void updateUIMask() ////private void updateUIMask()
////{ ////{
//// print("替换纹理"); //// Debug.Log("替换纹理");
//// Sprite sprite = Sprite.Create(clickTexture2D, new Rect(0, 0, clickTexture2D.width, clickTexture2D.height), new Vector2(0.5f, 0.5f)); //// Sprite sprite = Sprite.Create(clickTexture2D, new Rect(0, 0, clickTexture2D.width, clickTexture2D.height), new Vector2(0.5f, 0.5f));
//// sprite.name = "rand__temp__text_localFile"; //// sprite.name = "rand__temp__text_localFile";
//// image0.sprite = sprite; //// image0.sprite = sprite;
...@@ -164,7 +164,7 @@ public class tempzhangs : MonoBehaviour ...@@ -164,7 +164,7 @@ public class tempzhangs : MonoBehaviour
// Byte[] bytes1 = Encoding.UTF8.GetBytes("fileFormatVersion: 2\r\nguid: 54ac8b67ea1f6f14892bd14ea1caab62\r\nTextureImporter:\r\n internalIDToNameTable: []\r\n externalObjects: {}\r\n serializedVersion: 12\r\n mipmaps:\r\n mipMapMode: 0\r\n enableMipMap: 0\r\n sRGBTexture: 1\r\n linearTexture: 0\r\n fadeOut: 0\r\n borderMipMap: 0\r\n mipMapsPreserveCoverage: 0\r\n alphaTestReferenceValue: 0.5\r\n mipMapFadeDistanceStart: 1\r\n mipMapFadeDistanceEnd: 3\r\n bumpmap:\r\n convertToNormalMap: 0\r\n externalNormalMap: 0\r\n heightScale: 0.25\r\n normalMapFilter: 0\r\n flipGreenChannel: 0\r\n isReadable: 0\r\n streamingMipmaps: 0\r\n streamingMipmapsPriority: 0\r\n vTOnly: 0\r\n ignoreMipmapLimit: 0\r\n grayScaleToAlpha: 0\r\n generateCubemap: 6\r\n cubemapConvolution: 0\r\n seamlessCubemap: 0\r\n textureFormat: 1\r\n maxTextureSize: 2048\r\n textureSettings:\r\n serializedVersion: 2\r\n filterMode: 1\r\n aniso: 1\r\n mipBias: 0\r\n wrapU: 1\r\n wrapV: 1\r\n wrapW: 1\r\n nPOTScale: 0\r\n lightmap: 0\r\n compressionQuality: 50\r\n spriteMode: 1\r\n spriteExtrude: 1\r\n spriteMeshType: 1\r\n alignment: 0\r\n spritePivot: {x: 0.5, y: 0.5}\r\n spritePixelsToUnits: 1\r\n spriteBorder: {x: 0, y: 0, z: 0, w: 0}\r\n spriteGenerateFallbackPhysicsShape: 1\r\n alphaUsage: 1\r\n alphaIsTransparency: 1\r\n spriteTessellationDetail: -1\r\n textureType: 8\r\n textureShape: 1\r\n singleChannelComponent: 0\r\n flipbookRows: 1\r\n flipbookColumns: 1\r\n maxTextureSizeSet: 0\r\n compressionQualitySet: 0\r\n textureFormatSet: 0\r\n ignorePngGamma: 0\r\n applyGammaDecoding: 0\r\n swizzle: 50462976\r\n cookieLightType: 0\r\n platformSettings:\r\n - serializedVersion: 3\r\n buildTarget: DefaultTexturePlatform\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Standalone\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Server\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Android\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n spriteSheet:\r\n serializedVersion: 2\r\n sprites: []\r\n outline: []\r\n physicsShape: []\r\n bones: []\r\n spriteID: 5e97eb03825dee720800000000000000\r\n internalID: 0\r\n vertices: []\r\n indices: \r\n edges: []\r\n weights: []\r\n secondaryTextures: []\r\n nameFileIdTable: {}\r\n mipmapLimitGroupName: \r\n pSDRemoveMatte: 0\r\n userData: \r\n assetBundleName: \r\n assetBundleVariant: \r\n"); // Byte[] bytes1 = Encoding.UTF8.GetBytes("fileFormatVersion: 2\r\nguid: 54ac8b67ea1f6f14892bd14ea1caab62\r\nTextureImporter:\r\n internalIDToNameTable: []\r\n externalObjects: {}\r\n serializedVersion: 12\r\n mipmaps:\r\n mipMapMode: 0\r\n enableMipMap: 0\r\n sRGBTexture: 1\r\n linearTexture: 0\r\n fadeOut: 0\r\n borderMipMap: 0\r\n mipMapsPreserveCoverage: 0\r\n alphaTestReferenceValue: 0.5\r\n mipMapFadeDistanceStart: 1\r\n mipMapFadeDistanceEnd: 3\r\n bumpmap:\r\n convertToNormalMap: 0\r\n externalNormalMap: 0\r\n heightScale: 0.25\r\n normalMapFilter: 0\r\n flipGreenChannel: 0\r\n isReadable: 0\r\n streamingMipmaps: 0\r\n streamingMipmapsPriority: 0\r\n vTOnly: 0\r\n ignoreMipmapLimit: 0\r\n grayScaleToAlpha: 0\r\n generateCubemap: 6\r\n cubemapConvolution: 0\r\n seamlessCubemap: 0\r\n textureFormat: 1\r\n maxTextureSize: 2048\r\n textureSettings:\r\n serializedVersion: 2\r\n filterMode: 1\r\n aniso: 1\r\n mipBias: 0\r\n wrapU: 1\r\n wrapV: 1\r\n wrapW: 1\r\n nPOTScale: 0\r\n lightmap: 0\r\n compressionQuality: 50\r\n spriteMode: 1\r\n spriteExtrude: 1\r\n spriteMeshType: 1\r\n alignment: 0\r\n spritePivot: {x: 0.5, y: 0.5}\r\n spritePixelsToUnits: 1\r\n spriteBorder: {x: 0, y: 0, z: 0, w: 0}\r\n spriteGenerateFallbackPhysicsShape: 1\r\n alphaUsage: 1\r\n alphaIsTransparency: 1\r\n spriteTessellationDetail: -1\r\n textureType: 8\r\n textureShape: 1\r\n singleChannelComponent: 0\r\n flipbookRows: 1\r\n flipbookColumns: 1\r\n maxTextureSizeSet: 0\r\n compressionQualitySet: 0\r\n textureFormatSet: 0\r\n ignorePngGamma: 0\r\n applyGammaDecoding: 0\r\n swizzle: 50462976\r\n cookieLightType: 0\r\n platformSettings:\r\n - serializedVersion: 3\r\n buildTarget: DefaultTexturePlatform\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Standalone\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Server\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n - serializedVersion: 3\r\n buildTarget: Android\r\n maxTextureSize: 2048\r\n resizeAlgorithm: 0\r\n textureFormat: -1\r\n textureCompression: 1\r\n compressionQuality: 50\r\n crunchedCompression: 0\r\n allowsAlphaSplitting: 0\r\n overridden: 0\r\n ignorePlatformSupport: 0\r\n androidETC2FallbackOverride: 0\r\n forceMaximumCompressionQuality_BC6H_BC7: 0\r\n spriteSheet:\r\n serializedVersion: 2\r\n sprites: []\r\n outline: []\r\n physicsShape: []\r\n bones: []\r\n spriteID: 5e97eb03825dee720800000000000000\r\n internalID: 0\r\n vertices: []\r\n indices: \r\n edges: []\r\n weights: []\r\n secondaryTextures: []\r\n nameFileIdTable: {}\r\n mipmapLimitGroupName: \r\n pSDRemoveMatte: 0\r\n userData: \r\n assetBundleName: \r\n assetBundleVariant: \r\n");
// utilsTools.saveByteToPath(bytes1, "Resources/rand__temp__text_localFile.png.meta"); // utilsTools.saveByteToPath(bytes1, "Resources/rand__temp__text_localFile.png.meta");
//// utilsTools.loadLocalImage(this, image0, "Resources/rand__temp__text_localFile.png"); //// utilsTools.loadLocalImage(this, image0, "Resources/rand__temp__text_localFile.png");
//// print("替换纹理End"); //// Debug.Log("替换纹理End");
////} ////}
////private Vector2 ScreenToUILocalPos(RectTransform transform, Vector2 mousePos, Camera canvasCam = null) ////private Vector2 ScreenToUILocalPos(RectTransform transform, Vector2 mousePos, Camera canvasCam = null)
////{ ////{
......
...@@ -2,6 +2,7 @@ using System; ...@@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using static UnityEngine.ParticleSystem;
public class TaskManages public class TaskManages
{ {
...@@ -14,6 +15,22 @@ public class TaskManages ...@@ -14,6 +15,22 @@ public class TaskManages
{ {
return instance; return instance;
} }
//priorityStack
//内部是栈维护 当栈空的时候才会继续执行队列Queue中的任务
public void insertTask(MonoBehaviour monoBehaviour,TaskItemBack taskItemBack, System.Object[] allparams)
{
Stack<Tuple<TaskItemBack, System.Object[]>> taskInfos;
if (utilsTools.ContainsKey(monoBehaviour.gameObject, "PriorityStack") == false)
utilsTools.getUserData<Stack<Tuple<TaskItemBack, System.Object[]>>>(monoBehaviour.gameObject, "PriorityStack", out taskInfos, new Stack<Tuple<TaskItemBack, System.Object[]>>());
else
utilsTools.getUserData<Stack<Tuple<TaskItemBack, System.Object[]>>>(monoBehaviour.gameObject, "PriorityStack", out taskInfos, null);
utilsTools.setUserData(monoBehaviour.gameObject, "PriorityStack", taskInfos);
}
public void insertTask(MonoBehaviour monoBehaviour, TaskItemBack taskItemBack, System.Object param1 = null,System.Object param2 = null)
{
System.Object[] allparams = { param1,param2 };
insertTask(monoBehaviour, taskItemBack, allparams);
}
public void addTask(MonoBehaviour monoBehaviour, TaskItemBack taskItemBack, System.Object param = null) public void addTask(MonoBehaviour monoBehaviour, TaskItemBack taskItemBack, System.Object param = null)
{ {
System.Object[] allparams = { param }; System.Object[] allparams = { param };
...@@ -29,17 +46,37 @@ public class TaskManages ...@@ -29,17 +46,37 @@ public class TaskManages
taskInfos.Enqueue(new Tuple<TaskItemBack, object[]>(taskItemBack, allparams)); taskInfos.Enqueue(new Tuple<TaskItemBack, object[]>(taskItemBack, allparams));
utilsTools.setUserData(monoBehaviour.gameObject, "TaskList", taskInfos); utilsTools.setUserData(monoBehaviour.gameObject, "TaskList", taskInfos);
} }
private Tuple<TaskItemBack, System.Object[]> getTask(MonoBehaviour monoBehaviour)
{
Tuple<TaskItemBack, System.Object[]> ret = null;
if (utilsTools.ContainsKey(monoBehaviour.gameObject, "PriorityStack") == true)
{
Stack<Tuple<TaskItemBack, System.Object[]>> taskStackInfos = null;
utilsTools.getUserData<Stack<Tuple<TaskItemBack, System.Object[]>>>(monoBehaviour.gameObject, "PriorityStack", out taskStackInfos, null);
if(taskStackInfos.Count > 0)
{
ret = taskStackInfos.Pop();
utilsTools.setUserData(monoBehaviour.gameObject, "PriorityStack", taskStackInfos);
}
}
if (ret == null)
{
Queue<Tuple<TaskItemBack, System.Object[]>> taskInfos;
if (utilsTools.ContainsKey(monoBehaviour.gameObject, "TaskList") == false)
return null;
else
utilsTools.getUserData<Queue<Tuple<TaskItemBack, System.Object[]>>>(monoBehaviour.gameObject, "TaskList", out taskInfos, null);
if (taskInfos.Count == 0) return null;
ret = taskInfos.Dequeue();
utilsTools.setUserData(monoBehaviour.gameObject, "TaskList", taskInfos);
}
return ret;
}
public bool updateTask(MonoBehaviour monoBehaviour) public bool updateTask(MonoBehaviour monoBehaviour)
{ {
Queue<Tuple<TaskItemBack, System.Object[]>> taskInfos; var task = getTask(monoBehaviour);
if (utilsTools.ContainsKey(monoBehaviour.gameObject, "TaskList") == false) if (task == null) return false;
return false; task.Item1(task.Item2);
else
utilsTools.getUserData<Queue<Tuple<TaskItemBack, System.Object[]>>>(monoBehaviour.gameObject, "TaskList", out taskInfos, null);
if (taskInfos.Count == 0) return false;
var first = taskInfos.Dequeue();
utilsTools.setUserData(monoBehaviour.gameObject, "TaskList", taskInfos);
first.Item1(first.Item2);
return true; return true;
} }
public int taskSize(MonoBehaviour monoBehaviour) public int taskSize(MonoBehaviour monoBehaviour)
......
...@@ -477,7 +477,6 @@ public class utilsTools ...@@ -477,7 +477,6 @@ public class utilsTools
{ {
Directory.CreateDirectory(path1); Directory.CreateDirectory(path1);
} }
} }
} }
Base path: 'C:/Program Files/Unity/Hub/Editor/2022.3.1f1c1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2022.3.1f1c1/Editor/Data/PlaybackEngines' Base path: 'C:/Program Files/Unity/Hub/Editor/2022.3.1f1c1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2022.3.1f1c1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process
This diff is collapsed.
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment