Commit 4794eb71 authored by Ever's avatar Ever

主逻辑

parent 8be22438
...@@ -3,6 +3,7 @@ using NUnit.Framework; ...@@ -3,6 +3,7 @@ using NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using UnityEditor; using UnityEditor;
...@@ -45,6 +46,16 @@ public class GameEditor ...@@ -45,6 +46,16 @@ public class GameEditor
fs.Close(); fs.Close();
} }
} }
Color[] list = rd.png.GetPixels(0);
for (int i = 0; i < list.Length; i++)
{
if (list[i].a <= 0.35f)
{
list[i] = Color.white;
}
}
rd.png.SetPixels(list);
rd.png.Apply();
string savePath = AssetDatabase.GetAssetPath(Selection.activeInstanceID) + "/" + rd.name + ".bin"; string savePath = AssetDatabase.GetAssetPath(Selection.activeInstanceID) + "/" + rd.name + ".bin";
FileStream saveFs = File.Open(savePath, FileMode.Create); FileStream saveFs = File.Open(savePath, FileMode.Create);
......
...@@ -36,6 +36,10 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag ...@@ -36,6 +36,10 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
png = _png; png = _png;
jpg = _jpg; jpg = _jpg;
json = _json; json = _json;
imgpng.sprite = Sprite.Create(png, new Rect(0, 0, png.width, png.height), new Vector2(0.5f, 0.5f));
imgpng.GetComponent<RectTransform>().sizeDelta = new Vector2(png.width, png.height);
imgjpg.sprite = jpg;
imgjpg.GetComponent<RectTransform>().sizeDelta = new Vector2(png.width, png.height);
GoOn(); GoOn();
} }
public void GoOn() public void GoOn()
...@@ -226,7 +230,7 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag ...@@ -226,7 +230,7 @@ public class MainData : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDrag
for (int i = 0; i < d.Length; i++) for (int i = 0; i < d.Length; i++)
{ {
v_2 = v_1 + d[i]; v_2 = v_1 + d[i];
if (v_2.x >= 0 && v_2.x < png.width && v_2.y >= 0 && v_2.y < png.height && png.GetPixel((int)v_2.x, (int)v_2.y).a <= 0.35f) if (v_2.x >= 0 && v_2.x < png.width && v_2.y >= 0 && v_2.y < png.height && png.GetPixel((int)v_2.x, (int)v_2.y) == Color.white)
{ {
stackVector2.Push(v_2); stackVector2.Push(v_2);
} }
......
...@@ -8927,6 +8927,7 @@ MonoBehaviour: ...@@ -8927,6 +8927,7 @@ MonoBehaviour:
showFontSizeMax: 25 showFontSizeMax: 25
clickPosEff: {fileID: 5397047662947055783, guid: 1765abab6384f17448d404269ec52238, type: 3} clickPosEff: {fileID: 5397047662947055783, guid: 1765abab6384f17448d404269ec52238, type: 3}
selectTextureIdx: 0 selectTextureIdx: 0
MrgParent: {fileID: 7418061516327095409}
--- !u!114 &8094727572906316438 --- !u!114 &8094727572906316438
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -59,7 +59,6 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -59,7 +59,6 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
private ColorIndexTables nowSelectColors = null; private ColorIndexTables nowSelectColors = null;
public Transform MrgParent; public Transform MrgParent;
public Transform LoadingPanel;
public int SelectTextureIdx public int SelectTextureIdx
{ {
get { return selectTextureIdx; } get { return selectTextureIdx; }
...@@ -1718,15 +1717,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -1718,15 +1717,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
item.localRotation = Quaternion.Euler(0, 0, 0); item.localRotation = Quaternion.Euler(0, 0, 0);
item.localScale= Vector3.one; item.localScale= Vector3.one;
var png = Resources.Load<Texture2D>("cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ"); var png = Resources.Load<Texture2D>("cc2D9Z2w9k0evqUiCQ/png");
var jpg_texture = Resources.Load<Texture2D>("cc2D9Z2w9k0evqUiCQ/cc2D9Z2w9k0evqUiCQ"); var jpg_texture = Resources.Load<Texture2D>("cc2D9Z2w9k0evqUiCQ/jpg");
var jpg= Sprite.Create(jpg_texture, new Rect(0, 0, jpg_texture.width, jpg_texture.height), new Vector2(0.5f, 0.5f)); var jpg= Sprite.Create(jpg_texture, new Rect(0, 0, jpg_texture.width, jpg_texture.height), new Vector2(0.5f, 0.5f));
var jsondata = getdata(); var jsondata = getdata();
item.GetComponent<GameMgr>().Init(png, jpg, jsondata); item.GetComponent<GameMgr>().Init(png, jpg, jsondata);
CloseLoadingPanel();
} }
...@@ -1739,9 +1736,4 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -1739,9 +1736,4 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
readFs.Close(); readFs.Close();
return rjd; return rjd;
} }
private void CloseLoadingPanel()
{
LoadingPanel.gameObject.SetActive(false);
}
} }
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