Commit b3e87a9a authored by shujianhe's avatar shujianhe

1

parent df72c924
......@@ -43,16 +43,28 @@ public class gameIdJsonData
}
public short getNextGid(short nowGid)
{
for (int i = 0; i < roomDatas.Count; i++)
for (int i = 0; i < roomGroupsData.Count; i++)
{
if (roomDatas[i].id.Equals(nowGid))
if (roomGroupsData[i].id.Equals(nowGid))
{
if (i == roomGroupsData.Count - 1) return -1;
if (i.Equals(roomGroupsData.Count - 1)) return -1;
return roomGroupsData[i + 1].id;
}
}
return -1;
}
public short getPrveGid(short nowGid)
{
for (int i = 0; i < roomGroupsData.Count; i++)
{
if (roomGroupsData[i].id.Equals(nowGid))
{
if (i == 0) return -1;
return roomGroupsData[i - 1].id;
}
}
return -1;
}
public gameAreaGroupItem getRoomGroup(short id)
{
for (int i = 0; i < roomGroupsData.Count; i++)
......
......@@ -49,6 +49,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
{
Application.targetFrameRate = 60;
}
utilsTools.setGDataByKey("autoFillColor", false);
dtime = DateTime.Now;
if (utilsTools.ContainsKeyGDataByKey("urlRoot") == false)
......@@ -67,6 +68,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
onEvent("tipShowPosMaxScale", onTipShowPosMaxScaleEvent);
onEvent("gamePlayerEndHandler", onGamePlayerEndHandlerEvent);
onEvent("closeGameScene", onCloseGameSceneEvent);
onEvent("removeGroupByGid", onRemoveGroupByGidEvent);
transform.Find("ingameLoad/loadImg").gameObject.SetActive(false);
//gameScenUser
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
......@@ -186,23 +188,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
var maingameView = gameShowView.GetComponent<mainGameView>();
int idx = (int)objects[0];
bool idxIsIndex = true;
if(objects.Count > 1)
{
idxIsIndex = (bool)objects[1];
}
if (idxIsIndex.Equals(false))
{
short gid = (short)idx;
for (int i = 0; i < groupInfos.Count; i++)
{
if (gid.Equals(groupInfos[i].gid))
{
idx = i;
break;
}
}
}
nowidx = idx;
var nowSelectGroupId = groupInfos[idx].gid;
item = gridViewList.getObjectById(idx).GetComponent<colorItem>();
......@@ -604,13 +589,13 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//gameEndLogic gameEndlogic = transform.Find("gameEndOperBase").GetComponent<gameEndLogic>();
//gameEndlogic.initView();
//暂时调回放场景
utilsTools.sendEvent("CloseScenePrve");
utilsTools.addTimer_Update(gameObject, "close", (String name) =>
{
gameShowView.GetComponent<mainGameView>().onClear();
SceneManager.LoadScene("Scenes/replayeScene");
return false;
}, 10);
utilsTools.sendEvent("closeGameScene");
// utilsTools.addTimer_Update(gameObject, "close", (String name) =>
// {
// gameShowView.GetComponent<mainGameView>().onClear();
// SceneManager.LoadScene("Scenes/replayeScene");
// return false;
// }, 10);
}
void onSelectAreaEvent(List<UnityEngine.Object> uobjects, List<System.Object> objects)
{
......@@ -680,8 +665,43 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
}
}
public void onRemoveGroupByGidEvent(List<UnityEngine.Object> uobjects, List<System.Object> objects)
{
short gid = (short)objects[0];
short gid1 = (short)objects[1];
for (int i = 0; i < groupInfos.Count; i++)
{
if (groupInfos[i].gid.Equals(gid))
{
nowidx = i;
groupInfos.RemoveAt(i);
break;
}
}
if(nowidx < 0)
{
for (int i = 0; i < groupInfos.Count; i++)
{
if (groupInfos[i].gid.Equals(gid1))
{
nowidx = i;
break;
}
}
}
if (nowidx >= groupInfos.Count) nowidx = groupInfos.Count - 1;
var gridViewList = areaGroupList.GetComponent<gameSceneAreaGroupHandler>();
gradViewBack gradView = (GameObject gobject, int idx, ListViewBackTypeEnum lvbType) => {
this.onUpdateGroupGridHandler(gobject, idx, lvbType, groupInfos[idx], false);
};
gridViewList.setDataNoGrid(groupInfos.Count, tempValue1, tempValue2, tempValue3, gradView, false);
var maingameView = gameShowView.GetComponent<mainGameView>();
if (nowidx < 0) return;
maingameView.switchShowAreaGroup((short)(groupInfos[nowidx].gid));
}
public void onCloseGameSceneEvent(List<UnityEngine.Object> uobjects, List<System.Object> objects)
{
if (utilsTools.getGDataByKey<bool>("autoFillColor", false)) return;
Debug.Log("准备关闭");
utilsTools.sendEvent("CloseScenePrve");
utilsTools.addTimer_Update(gameObject, "close", (String name) =>
......
......@@ -26,6 +26,11 @@ public class gameUserInfos : MonoBehaviour, IEventHandler
onEvent("CloseScenePrve", onCloseScenePrveHandler);
utilsTools.addTimer_Update(gameObject, "first", (string name) =>
{
if (utilsTools.ContainsKeyGDataByKey("NativeGameData") == false)
{
string json = "{\"append\":\"\",\"classId\":\"1,8,10,14\",\"displayDate\":\"20221102\",\"enterType\":\"0\",\"extraJson\":\"{\\\"cut_height\\\": 0, \\\"refer_drawer\\\": \\\"DoMyzu\\\"}\",\"extraType\":0,\"file\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/cc--EDgRpc_nHQru7H.png\",\"hybridType\":64,\"id\":\"cc--EDgRpc_nHQru7H\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/cc--EDgRpc_nHQru7H.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}";
utilsTools.setGDataByKey("NativeGameData", JsonUtility.FromJson<netLableImageItem>(json));
}
if (utilsTools.ContainsKeyGDataByKey("NativeGameData") == false)
{
loadTest();
......
......@@ -18,14 +18,14 @@ public class Native : MonoBehaviour
{
string param = utilsTools.getGDataByKey<string>("NativeTempData", "splash");
showHostMainWindow(param);
#if UNITY_EDITOR
//#if UNITY_EDITOR
utilsTools.addTimer_Sec(gameObject, "dsfds", (String name) =>
{
utilsTools.setGDataByKey("NativeTempData", "test");
jumpGame("");
return false;
}, 1);
#endif
//#endif
Debug.Log("UnityStart");
}
private void OnEnable()
......@@ -63,11 +63,11 @@ public class Native : MonoBehaviour
}
void jumpGame(string json)
{
#if UNITY_EDITOR
//#if UNITY_EDITOR
Debug.Log("JSON:" + json);
json = "{\"append\":\"\",\"classId\":\"1,8,10,14\",\"displayDate\":\"20221102\",\"enterType\":\"0\",\"extraJson\":\"{\\\"cut_height\\\": 0, \\\"refer_drawer\\\": \\\"DoMyzu\\\"}\",\"extraType\":0,\"file\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/cc--EDgRpc_nHQru7H.png\",\"hybridType\":64,\"id\":\"cc--EDgRpc_nHQru7H\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/cc--EDgRpc_nHQru7H.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}";
//json = "{\"append\":\"\",\"classId\":\"1,8,10,14\",\"displayDate\":\"20221102\",\"enterType\":\"0\",\"extraJson\":\"{\\\"cut_height\\\": 0, \\\"refer_drawer\\\": \\\"DoMyzu\\\"}\",\"extraType\":0,\"file\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/ccnKNH1bTLS-_Mg7A2.png\",\"hybridType\":64,\"id\":\"ccnKNH1bTLS-_Mg7A2\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/ccnKNH1bTLS-_Mg7A2.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}";
#endif
//#endif
utilsTools.setGDataByKey("NativeGameData", JsonUtility.FromJson<netLableImageItem>(json));
SceneManager.LoadScene(utilsTools.getGameSceneName());
......
......@@ -395,11 +395,13 @@ public class mainGameScaleMove : MonoBehaviour
}
public void onAutoFillHander()
{
if (utilsTools.getGDataByKey<bool>("autoFillColor", false)) return;
onResetSizeCenterHandler();
GetComponent<mainGameView>().onAutoFillHandler();
}
public void onTipShowPosMaxScale(gameAreaItem areaItem,float width,float height)
{
if (utilsTools.getGDataByKey<bool>("autoFillColor", false)) return;
nowScale = new Vector2(maxScale,maxScale);
Vector3 pos = new Vector3();
float ptx = areaItem.px / width * 1.0f;//百分比
......
......@@ -43,7 +43,7 @@ public class mainGameView : MonoBehaviour
protected short bianlun = -1;
protected short fullShow = -2;
protected Texture2D thumbnailTexture2d = null;
private bool isDebugTestToEnd = true;
private bool isDebugTestToEnd = false;
public GameObject clickPosEff = null;
Dictionary<string, Color[]> allColor = new Dictionary<string, Color[]>();
[SerializeField]
......@@ -863,7 +863,7 @@ public class mainGameView : MonoBehaviour
{
utilsTools.setGDataByKey("firstSwitchShowAreaBegin", utilsTools.getTotalMillisecond());
}
if (gid == nowSelectgid)
if (gid .Equals(nowSelectgid))
{
if(onAreaHandler != null)
onAreaHandler(gid, true);
......@@ -1367,7 +1367,7 @@ public class mainGameView : MonoBehaviour
//恢复尺寸
//锁定输入
utilsTools.setGDataByKey("enableZoomMove", false);
utilsTools.setGDataByKey("autoFillColor", true);
short gid = nowSelectgid < 0 ? gameidJsondata.roomGroupsData[0].id : nowSelectgid;
List<short> aids = new List<short>();
do
......@@ -1375,6 +1375,19 @@ public class mainGameView : MonoBehaviour
getIdsByAreaId(gid,(short)(20 - aids.Count), ref aids);
gid = gameidJsondata.getNextGid(gid);
} while (gid > -1 && aids.Count < 20);
if(aids.Count < 20)
{
if(nowSelectgid > 0)
{
gid = gameidJsondata.getPrveGid(nowSelectgid);
while(gid > -1)
{
getIdsByAreaId(gid, (short)(20 - aids.Count), ref aids);
gid = gameidJsondata.getPrveGid(gid);
}
}
}
int idx = 0;
int aidsLen = aids.Count();
//查找
......@@ -1386,14 +1399,15 @@ public class mainGameView : MonoBehaviour
var infos = gameidJsondata.getAid(aid);
if(infos.gid.Equals(nowSelectgid) == false)
{
int gid = infos.gid;
utilsTools.sendEventObjectParams("switchGameAreaGroupId", gid, false);
short gid = infos.gid;
utilsTools.sendEventObjectParams("removeGroupByGid", nowSelectgid,gid);
}
showAreaByPos(infos.px, infos.py, null, true);
idx++;
if (idx.Equals(aidsLen))
{
utilsTools.setGDataByKey("enableZoomMove", true);
utilsTools.setGDataByKey("autoFillColor", false);
return false;
}
}
......
......@@ -224,6 +224,7 @@ public class colorItem : MonoBehaviour
{
if (isSelect == false && isFinish() == false)
{
if (utilsTools.getGDataByKey<bool>("autoFillColor", false)) return;
utilsTools.sendEventObjectParams("switchGameAreaGroupId", index);
}
}
......@@ -233,12 +234,5 @@ public class colorItem : MonoBehaviour
}
public void resetSize(float x,float y)
{
//RectTransform rectTransform = GetComponent<RectTransform>();
//rectTransform.localScale = new Vector3 (100f/x,100f/y, 1);
int cout = transform.childCount;
for (int i = 0; i < cout; i++)
{
//transform.GetChild(i).localScale= new Vector3(x/100f, y/100f, 1);
}
}
}
......@@ -75,14 +75,12 @@ public class utilsTools
}
public static string getGameSceneName()
{
if (Boolean.Parse(getGDataByKey<string>("showBackPlayer", "false")) == false)
if (getGDataByKey<string>("Native_name", "main").Equals("mine") == false)
{
return "Scenes/gameScene";
}
else
return "Scenes/replayeScene";
}
public static bool removeGDataByKey(string key)
{
......
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