Commit 6c045fb5 authored by shujianhe's avatar shujianhe

1

parent dcfc56ba
...@@ -13,4 +13,34 @@ namespace Assets.scripts.Datas ...@@ -13,4 +13,34 @@ namespace Assets.scripts.Datas
public string name; public string name;
public string path = "";//暂时空 public string path = "";//暂时空
} }
public class SettnigToGame
{
//{"uid":"876511","highlightId":0,"coloredPictures":0,"autoSwitch":0,"fillAnimation":0,"vibration":0}
public string uid;
public int highlightId = 0;
public int coloredPictures = 0;
public int autoSwitch = 0;
public int fillAnimation = 0;
public int vibration = 0;
public string getHighlightId()
{
return highlightId.ToString();
}
public string getColoredPictures()
{
return coloredPictures.Equals(0) ? "false" : "true";
}
public string getAutoSwitch()
{
return autoSwitch.Equals(0) ? "false" : "true";
}
public string getFillAnimation()
{
return fillAnimation.Equals(0) ? "false" : "true";
}
public string getVibration()
{
return vibration.Equals(0) ? "false" : "true";
}
}
} }
using Assets.scripts.Datas;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -71,6 +72,16 @@ public class Native : MonoBehaviour ...@@ -71,6 +72,16 @@ public class Native : MonoBehaviour
SceneManager.LoadScene(utilsTools.getGameSceneName()); SceneManager.LoadScene(utilsTools.getGameSceneName());
} }
void setSettings(String json)
{
SettnigToGame settnigToGame = JsonUtility.FromJson<SettnigToGame>(json);
utilsTools.setGDataByKey("auto_switch", settnigToGame.getAutoSwitch());
utilsTools.setGDataByKey("vibration", settnigToGame.getVibration());
utilsTools.setGDataByKey("highlight_areas", settnigToGame.getHighlightId());
utilsTools.setGDataByKey("uid", settnigToGame.uid);
utilsTools.setGDataByKey("fillanimation", settnigToGame.getFillAnimation());
}
void onNativeHashKeyValue(string json) void onNativeHashKeyValue(string json)
{ {
......
...@@ -49,9 +49,9 @@ public class mainGameView : MonoBehaviour ...@@ -49,9 +49,9 @@ public class mainGameView : MonoBehaviour
[SerializeField] [SerializeField]
protected int selectTextureIdx = 1; protected int selectTextureIdx = 1;
static protected string[] allSelectTexturePaths = { static protected string[] allSelectTexturePaths = {
"scenes/game/cells/grayCell",
"scenes/game/cells/buleCell", "scenes/game/cells/buleCell",
"scenes/game/cells/gray", "scenes/game/cells/gray",
"scenes/game/cells/grayCell"
}; };
private ColorIndexTables nowSelectColors = null; private ColorIndexTables nowSelectColors = null;
public int SelectTextureIdx public int SelectTextureIdx
...@@ -192,19 +192,19 @@ public class mainGameView : MonoBehaviour ...@@ -192,19 +192,19 @@ public class mainGameView : MonoBehaviour
resetSize(); resetSize();
onInitEndHandler(); onInitEndHandler();
if (thumbnailTexture2d != null) { if (thumbnailTexture2d != null) {
utilsTools.addTimer_Update(gameObject, "shouhuThumbnailIsChange", (String _) => //utilsTools.addTimer_Update(gameObject, "shouhuThumbnailIsChange", (String _) =>
{ //{
if (thumbnailIsChange == true) // if (thumbnailIsChange == true)
{ // {
thumbnailIsChange = false; // thumbnailIsChange = false;
thumbnailTexture2d.SetPixels(allColor["thumbnail"]); // thumbnailTexture2d.SetPixels(allColor["thumbnail"]);
string path = gameScenUseInfo.getLocalThumbnailPath(); // string path = gameScenUseInfo.getLocalThumbnailPath();
var sltTextureSize = utilsTools.getGDataByKey<Vector2>("sltTextureSize", Vector2.one); // var sltTextureSize = utilsTools.getGDataByKey<Vector2>("sltTextureSize", Vector2.one);
//utilsTools.saveByteToPath(utilsTools.ScaleTexture(thumbnailTexture2d, Convert.ToInt32(sltTextureSize.x), Convert.ToInt32(sltTextureSize.y)).EncodeToJPG(), path); // utilsTools.saveByteToPath(utilsTools.ScaleTexture(thumbnailTexture2d, Convert.ToInt32(sltTextureSize.x), Convert.ToInt32(sltTextureSize.y)).EncodeToJPG(), path);
//utilsTools.saveByteToPath(thumbnailTexture2d.EncodeToJPG(), path); // utilsTools.saveByteToPath(thumbnailTexture2d.EncodeToJPG(), path);
} // }
return true; // return true;
}, 120, 0); //}, 120, 0);
} }
} }
protected string getSelectPathByGid(int gid) protected string getSelectPathByGid(int gid)
...@@ -1235,7 +1235,7 @@ public class mainGameView : MonoBehaviour ...@@ -1235,7 +1235,7 @@ public class mainGameView : MonoBehaviour
} }
protected virtual void drawThumbnailByAid(List<short> aids) protected virtual void drawThumbnailByAid(List<short> aids)
{ {
if (false) if (true)
{ {
TaskItemBack taskItemBack = (System.Object[] parmass) => TaskItemBack taskItemBack = (System.Object[] parmass) =>
{ {
...@@ -1316,8 +1316,18 @@ public class mainGameView : MonoBehaviour ...@@ -1316,8 +1316,18 @@ public class mainGameView : MonoBehaviour
} }
public void onClear() public void onClear()
{ {
if(thumbnailTexture2d != null) if (thumbnailTexture2d != null)
{ {
thumbnailTexture2d.SetPixels(allColor["thumbnail"]);
string path = gameScenUseInfo.getLocalThumbnailPath();
var sltTextureSize = new Vector2(400, 400);// utilsTools.getGDataByKey<Vector2>("sltTextureSize", Vector2.one);
if (thumbnailTexture2d.width.Equals(thumbnailTexture2d.height) == false)
{
sltTextureSize = new Vector2(200, 400);
}
utilsTools.saveByteToPath(utilsTools.ScaleTexture(thumbnailTexture2d, Convert.ToInt32(sltTextureSize.x), Convert.ToInt32(sltTextureSize.y)).EncodeToJPG(), path);
utilsTools.saveByteToPath(thumbnailTexture2d.EncodeToJPG(), path);
Destroy(thumbnailTexture2d); Destroy(thumbnailTexture2d);
thumbnailTexture2d = null; thumbnailTexture2d = null;
} }
......
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