完善键盘,区分数字和其他
parent
93507fff83
commit
05f9f3d4dc
|
@ -1281,7 +1281,8 @@ MonoBehaviour:
|
||||||
model: {fileID: 6293017588140709312}
|
model: {fileID: 6293017588140709312}
|
||||||
doTweenTime: 0.3
|
doTweenTime: 0.3
|
||||||
designCoverModelItem: {fileID: 9095075417828674992}
|
designCoverModelItem: {fileID: 9095075417828674992}
|
||||||
renderCamera: {fileID: 2276259505965401185}
|
previewCamera: {fileID: 2276259505965401185}
|
||||||
|
designCamera: {fileID: 2572391983687865557}
|
||||||
--- !u!4 &6293017588140709312 stripped
|
--- !u!4 &6293017588140709312 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 5925587547739504176, guid: 454073324e4bb4b439eed7022d8c2bf9,
|
m_CorrespondingSourceObject: {fileID: 5925587547739504176, guid: 454073324e4bb4b439eed7022d8c2bf9,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -221,7 +221,7 @@ RectTransform:
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: -17, y: 0}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!222 &6276670929431658983
|
--- !u!222 &6276670929431658983
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
|
@ -1641,7 +1641,7 @@ GameObject:
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &567649602442340089
|
--- !u!224 &567649602442340089
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -3399,14 +3399,14 @@ MonoBehaviour:
|
||||||
m_VerticalScrollbarEventHandler: {fileID: 0}
|
m_VerticalScrollbarEventHandler: {fileID: 0}
|
||||||
m_LayoutGroup: {fileID: 0}
|
m_LayoutGroup: {fileID: 0}
|
||||||
m_ScrollSensitivity: 1
|
m_ScrollSensitivity: 1
|
||||||
m_ContentType: 0
|
m_ContentType: 2
|
||||||
m_InputType: 0
|
m_InputType: 0
|
||||||
m_AsteriskChar: 42
|
m_AsteriskChar: 42
|
||||||
m_KeyboardType: 0
|
m_KeyboardType: 4
|
||||||
m_LineType: 0
|
m_LineType: 0
|
||||||
m_HideMobileInput: 0
|
m_HideMobileInput: 0
|
||||||
m_HideSoftKeyboard: 0
|
m_HideSoftKeyboard: 0
|
||||||
m_CharacterValidation: 0
|
m_CharacterValidation: 2
|
||||||
m_RegexValue:
|
m_RegexValue:
|
||||||
m_GlobalPointSize: 40
|
m_GlobalPointSize: 40
|
||||||
m_CharacterLimit: 0
|
m_CharacterLimit: 0
|
||||||
|
|
|
@ -1166,6 +1166,16 @@ PrefabInstance:
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7898714653653960622, guid: ec1221012f9c7084492b9007422cc1b7,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7898714653653960622, guid: ec1221012f9c7084492b9007422cc1b7,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8611488140566695850, guid: ec1221012f9c7084492b9007422cc1b7,
|
- target: {fileID: 8611488140566695850, guid: ec1221012f9c7084492b9007422cc1b7,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace HK.Keyboard
|
||||||
|
{
|
||||||
|
public class ColorsChange : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] List<Color> colors = new List<Color>();
|
||||||
|
public GameObject item;
|
||||||
|
public Keyboard keyboard;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
keyboard = GetComponentInParent<Keyboard>();
|
||||||
|
foreach (var color in colors)
|
||||||
|
{
|
||||||
|
var o = GameObject.Instantiate(item, item.transform.parent);
|
||||||
|
o.SetActive(true);
|
||||||
|
o.GetComponent<Image>().color = color;
|
||||||
|
o.GetComponent<Button>().onClick.AddListener(() => { keyboard.SetColor(color); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f34fe33e2d74ccfadf18715a13a5af2
|
||||||
|
timeCreated: 1752477208
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace HK.Keyboard
|
namespace HK.Keyboard
|
||||||
|
|
|
@ -5,11 +5,19 @@ using UnityEngine.UI;
|
||||||
|
|
||||||
namespace HK.Keyboard
|
namespace HK.Keyboard
|
||||||
{
|
{
|
||||||
|
public enum KeyType
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Number,
|
||||||
|
}
|
||||||
|
|
||||||
public class KeyBind : MonoBehaviour
|
public class KeyBind : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] public string keyName;
|
[SerializeField] public string keyName;
|
||||||
[SerializeField] public bool isPic = false;
|
[SerializeField] public bool isPic = false;
|
||||||
[SerializeField] public Image image;
|
[SerializeField] public Image image;
|
||||||
|
[SerializeField] public KeyType keyType = KeyType.None;
|
||||||
|
private Button button;
|
||||||
public Action<string> onClickAction;
|
public Action<string> onClickAction;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
@ -23,12 +31,18 @@ namespace HK.Keyboard
|
||||||
// GetComponentInChildren<TMP_Text>().text = keyName;
|
// GetComponentInChildren<TMP_Text>().text = keyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetComponent<Button>().onClick.AddListener(OnClick);
|
button = GetComponent<Button>();
|
||||||
|
button.onClick.AddListener(OnClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClick()
|
private void OnClick()
|
||||||
{
|
{
|
||||||
onClickAction?.Invoke(keyName);
|
onClickAction?.Invoke(keyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetInteractable(bool isInteractable)
|
||||||
|
{
|
||||||
|
button.interactable = isInteractable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,6 +8,12 @@ using ZGame;
|
||||||
|
|
||||||
namespace HK.Keyboard
|
namespace HK.Keyboard
|
||||||
{
|
{
|
||||||
|
public enum KeyboardType
|
||||||
|
{
|
||||||
|
All,
|
||||||
|
NumberOnly,
|
||||||
|
}
|
||||||
|
|
||||||
public class Keyboard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
public class Keyboard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||||
{
|
{
|
||||||
public TMP_InputField inputField;
|
public TMP_InputField inputField;
|
||||||
|
@ -16,9 +22,16 @@ namespace HK.Keyboard
|
||||||
public GameObject NumBoardUnshifted;
|
public GameObject NumBoardUnshifted;
|
||||||
public GameObject NumBoardShifted;
|
public GameObject NumBoardShifted;
|
||||||
public Button btnClickClose;
|
public Button btnClickClose;
|
||||||
|
public KeyboardType keyboardType = KeyboardType.All;
|
||||||
|
|
||||||
|
public FontsChange fontChange;
|
||||||
|
public ColorsChange colorChange;
|
||||||
|
|
||||||
public Keyboard_Chin chin;
|
public Keyboard_Chin chin;
|
||||||
private List<KeyBind> keyBinds;
|
private List<KeyBind> keyBinds;
|
||||||
|
private List<KeyBind> keyBinds_NumberOnly = new List<KeyBind>();
|
||||||
|
private List<KeyBind> keyBinds_LetterOnly = new List<KeyBind>();
|
||||||
|
private List<KeyBind> keyBinds_PinyinOnly = new List<KeyBind>();
|
||||||
private List<KeyBind> keyBinds_Switch;
|
private List<KeyBind> keyBinds_Switch;
|
||||||
private Action OKAction;
|
private Action OKAction;
|
||||||
public bool isHideOnAwake = false;
|
public bool isHideOnAwake = false;
|
||||||
|
@ -75,9 +88,41 @@ namespace HK.Keyboard
|
||||||
OKAction = args.OKAction;
|
OKAction = args.OKAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyboardType = args.keyboardType;
|
||||||
|
ChangeKeyboard();
|
||||||
|
colorChange.gameObject.SetActive(args.isChangeColor);
|
||||||
|
fontChange.gameObject.SetActive(args.isChangeFont);
|
||||||
gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChangeKeyboard()
|
||||||
|
{
|
||||||
|
switch (keyboardType)
|
||||||
|
{
|
||||||
|
case KeyboardType.All:
|
||||||
|
ShowOnlyOne(AlphaBoardUnshifted);
|
||||||
|
foreach (var key in keyBinds)
|
||||||
|
{
|
||||||
|
key.SetInteractable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case KeyboardType.NumberOnly:
|
||||||
|
ShowOnlyOne(NumBoardUnshifted);
|
||||||
|
foreach (var key in keyBinds)
|
||||||
|
{
|
||||||
|
if (key.keyType == KeyType.Number)
|
||||||
|
key.SetInteractable(true);
|
||||||
|
else
|
||||||
|
key.SetInteractable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ShowOnlyOne(GameObject go)
|
void ShowOnlyOne(GameObject go)
|
||||||
{
|
{
|
||||||
AlphaBoardUnshifted.SetActive(false);
|
AlphaBoardUnshifted.SetActive(false);
|
||||||
|
@ -198,6 +243,11 @@ namespace HK.Keyboard
|
||||||
inputField.fontAsset = font;
|
inputField.fontAsset = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColor(Color color)
|
||||||
|
{
|
||||||
|
inputField.textComponent.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
private bool isEnter;
|
private bool isEnter;
|
||||||
|
|
||||||
public void OnPointerEnter(PointerEventData eventData)
|
public void OnPointerEnter(PointerEventData eventData)
|
||||||
|
|
|
@ -10,11 +10,46 @@ namespace HK.Keyboard
|
||||||
public override int Id => EventId;
|
public override int Id => EventId;
|
||||||
|
|
||||||
public TMP_InputField inputField;
|
public TMP_InputField inputField;
|
||||||
|
public bool isChangeColor;
|
||||||
|
public bool isChangeFont;
|
||||||
|
public KeyboardType keyboardType;
|
||||||
public Action OKAction;
|
public Action OKAction;
|
||||||
|
|
||||||
public OpenKeyboardEventArgs(TMP_InputField inputField, Action okAction)
|
public OpenKeyboardEventArgs(TMP_InputField inputField, Action okAction)
|
||||||
{
|
{
|
||||||
this.inputField = inputField;
|
this.inputField = inputField;
|
||||||
|
this.isChangeColor = false;
|
||||||
|
this.isChangeFont = false;
|
||||||
|
this.keyboardType = KeyboardType.All;
|
||||||
|
OKAction = okAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenKeyboardEventArgs(TMP_InputField inputField, bool isChangeColor, Action okAction)
|
||||||
|
{
|
||||||
|
this.inputField = inputField;
|
||||||
|
this.isChangeColor = isChangeColor;
|
||||||
|
this.isChangeFont = false;
|
||||||
|
this.keyboardType = KeyboardType.All;
|
||||||
|
OKAction = okAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenKeyboardEventArgs(TMP_InputField inputField, bool isChangeColor, bool isChangeFont, Action okAction)
|
||||||
|
{
|
||||||
|
this.inputField = inputField;
|
||||||
|
this.isChangeColor = isChangeColor;
|
||||||
|
this.isChangeFont = isChangeFont;
|
||||||
|
this.keyboardType = KeyboardType.All;
|
||||||
|
OKAction = okAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenKeyboardEventArgs(TMP_InputField inputField, bool isChangeColor, bool isChangeFont,
|
||||||
|
KeyboardType keyboardType,
|
||||||
|
Action okAction)
|
||||||
|
{
|
||||||
|
this.inputField = inputField;
|
||||||
|
this.isChangeColor = isChangeColor;
|
||||||
|
this.isChangeFont = isChangeFont;
|
||||||
|
this.keyboardType = keyboardType;
|
||||||
OKAction = okAction;
|
OKAction = okAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,12 @@ namespace HK.Keyboard
|
||||||
|
|
||||||
private void SelectInputField(string arg0)
|
private void SelectInputField(string arg0)
|
||||||
{
|
{
|
||||||
EventManager.Instance.FireNow(OpenKeyboardEventArgs.EventId,
|
if (inputField.contentType == TMP_InputField.ContentType.IntegerNumber)
|
||||||
new OpenKeyboardEventArgs(inputField, OKAction));
|
EventManager.Instance.FireNow(OpenKeyboardEventArgs.EventId,
|
||||||
|
new OpenKeyboardEventArgs(inputField, false, false, KeyboardType.NumberOnly, OKAction));
|
||||||
|
else
|
||||||
|
EventManager.Instance.FireNow(OpenKeyboardEventArgs.EventId,
|
||||||
|
new OpenKeyboardEventArgs(inputField, false, false, OKAction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -48,7 +48,7 @@ namespace ZXL.Helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="camera"></param>
|
/// <param name="camera"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Texture2D SaveCameraToTexture(Camera camera, bool generateMipMaps = false,
|
public static Texture2D SaveCameraToTexture(Camera camera, bool generateMipMaps = false,
|
||||||
TextureFormat textureFormat = TextureFormat.RGBA32)
|
TextureFormat textureFormat = TextureFormat.RGBA32)
|
||||||
{
|
{
|
||||||
if (camera == null)
|
if (camera == null)
|
||||||
|
@ -63,33 +63,35 @@ namespace ZXL.Helper
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 创建临时RenderTexture
|
// 创建支持透明度的临时RenderTexture
|
||||||
tempRenderTexture = RenderTexture.GetTemporary(
|
tempRenderTexture = RenderTexture.GetTemporary(
|
||||||
camera.pixelWidth, camera.pixelHeight, 24, RenderTextureFormat.Default);
|
camera.pixelWidth, camera.pixelHeight, 24,
|
||||||
|
RenderTextureFormat.ARGB32, // 使用支持Alpha通道的格式
|
||||||
|
RenderTextureReadWrite.Default);
|
||||||
|
|
||||||
// 设置相机渲染到临时RenderTexture
|
// 设置相机渲染到临时RenderTexture
|
||||||
camera.targetTexture = tempRenderTexture;
|
camera.targetTexture = tempRenderTexture;
|
||||||
|
|
||||||
// 强制相机渲染一帧
|
// 强制相机渲染一帧
|
||||||
camera.Render();
|
camera.Render();
|
||||||
|
|
||||||
// 创建Texture2D
|
// 创建Texture2D
|
||||||
capturedImage = new Texture2D(
|
capturedImage = new Texture2D(
|
||||||
tempRenderTexture.width,
|
tempRenderTexture.width,
|
||||||
tempRenderTexture.height,
|
tempRenderTexture.height,
|
||||||
textureFormat,
|
textureFormat,
|
||||||
generateMipMaps);
|
generateMipMaps);
|
||||||
|
|
||||||
// 保存当前激活的RenderTexture
|
// 保存当前激活的RenderTexture
|
||||||
RenderTexture previousActive = RenderTexture.active;
|
RenderTexture previousActive = RenderTexture.active;
|
||||||
|
|
||||||
// 设置临时RenderTexture为当前激活的,以便读取像素
|
// 设置临时RenderTexture为当前激活的,以便读取像素
|
||||||
RenderTexture.active = tempRenderTexture;
|
RenderTexture.active = tempRenderTexture;
|
||||||
|
|
||||||
// 读取像素并应用
|
// 读取像素并应用
|
||||||
capturedImage.ReadPixels(new Rect(0, 0, tempRenderTexture.width, tempRenderTexture.height), 0, 0);
|
capturedImage.ReadPixels(new Rect(0, 0, tempRenderTexture.width, tempRenderTexture.height), 0, 0);
|
||||||
capturedImage.Apply();
|
capturedImage.Apply();
|
||||||
|
|
||||||
// 恢复之前的RenderTexture
|
// 恢复之前的RenderTexture
|
||||||
RenderTexture.active = previousActive;
|
RenderTexture.active = previousActive;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +108,7 @@ namespace ZXL.Helper
|
||||||
{
|
{
|
||||||
// 恢复相机的原始设置
|
// 恢复相机的原始设置
|
||||||
camera.targetTexture = originalTargetTexture;
|
camera.targetTexture = originalTargetTexture;
|
||||||
|
|
||||||
// 释放临时RenderTexture
|
// 释放临时RenderTexture
|
||||||
if (tempRenderTexture != null)
|
if (tempRenderTexture != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using ZGame;
|
using ZGame;
|
||||||
using ZXL.Helper;
|
using ZXL.Helper;
|
||||||
|
|
||||||
|
@ -15,12 +16,8 @@ namespace Runtime
|
||||||
|
|
||||||
[SerializeField] float doTweenTime = 1f;
|
[SerializeField] float doTweenTime = 1f;
|
||||||
[SerializeField] DesignCoverModelItem designCoverModelItem;
|
[SerializeField] DesignCoverModelItem designCoverModelItem;
|
||||||
[SerializeField] Camera renderCamera;
|
[SerializeField] Camera previewCamera;
|
||||||
|
[SerializeField] Camera designCamera;
|
||||||
// [SerializeField] private int index;
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[ContextMenu("TestPlay")]
|
[ContextMenu("TestPlay")]
|
||||||
public void PlayIndex(int index)
|
public void PlayIndex(int index)
|
||||||
|
@ -30,12 +27,33 @@ namespace Runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
[ContextMenu("GenPreviewImage")]
|
[ContextMenu("GenPreviewImage")]
|
||||||
public byte[] GenPreviewImage()
|
public List<byte[]> GenPreviewImage()
|
||||||
{
|
{
|
||||||
var texture2D = TextureHelper.SaveCameraToTexture(renderCamera);
|
var texture2D = TextureHelper.SaveCameraToTexture(previewCamera);
|
||||||
var bytes = texture2D.EncodeToPNG();
|
var previewBytes = texture2D.EncodeToPNG();
|
||||||
|
var texture2D1 = TextureHelper.SaveCameraToTexture(designCamera);
|
||||||
|
var designBytes = texture2D1.EncodeToPNG();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// save
|
||||||
|
#if (PLATFORM_STANDALONE_WIN || UNITY_STANDALONE_WIN) && !UNITY_EDITOR
|
||||||
|
string folder = $"{Application.persistentDataPath}/Notebook/{DateTime.Now.Ticks}";
|
||||||
|
if (!Directory.Exists(folder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllBytes(Path.Combine(folder, "previewImage.png"), previewBytes);
|
||||||
|
File.WriteAllBytes(Path.Combine(folder, "designImage.png"), designBytes);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log(e);
|
||||||
|
}
|
||||||
|
|
||||||
// File.WriteAllBytes($"{Application.dataPath}/tupian.png", bytes);
|
// File.WriteAllBytes($"{Application.dataPath}/tupian.png", bytes);
|
||||||
return bytes;
|
return new List<byte[]> { previewBytes, designBytes };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -138,8 +138,15 @@ namespace Runtime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int count;
|
public int count;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预览图
|
||||||
|
/// </summary>
|
||||||
public byte[] previewImage;
|
public byte[] previewImage;
|
||||||
public byte[] tifImage;
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计图
|
||||||
|
/// </summary>
|
||||||
|
public byte[] designImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShoppingCartManager : ManagerBase<ShoppingCartManager>
|
public class ShoppingCartManager : ManagerBase<ShoppingCartManager>
|
||||||
|
|
|
@ -70,7 +70,8 @@ namespace HK
|
||||||
if (args.isShow_InputText && !args.isShow_Sticker)
|
if (args.isShow_InputText && !args.isShow_Sticker)
|
||||||
{
|
{
|
||||||
EventManager.Instance.FireNow(this,
|
EventManager.Instance.FireNow(this,
|
||||||
new OpenKeyboardEventArgs(inpContent, inpContent.GetComponent<TMP_InputField_Register>().OKAction));
|
new OpenKeyboardEventArgs(inpContent, true, true,
|
||||||
|
inpContent.GetComponent<TMP_InputField_Register>().OKAction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using Data;
|
using Data;
|
||||||
using Runtime;
|
using Runtime;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
@ -62,15 +63,16 @@ namespace HK
|
||||||
{
|
{
|
||||||
var index = PlayerPersistent.GetInt("ProductIndex");
|
var index = PlayerPersistent.GetInt("ProductIndex");
|
||||||
var informationData = ExcelManager.NoteBookInformation.GetData(index);
|
var informationData = ExcelManager.NoteBookInformation.GetData(index);
|
||||||
byte[] bytes = notebook.GenPreviewImage();
|
List<byte[]> bytes = notebook.GenPreviewImage();
|
||||||
|
|
||||||
var cartData = new ShoppingCartData()
|
var cartData = new ShoppingCartData()
|
||||||
{
|
{
|
||||||
bookAmount = informationData.BookPrice+informationData.DesignPrice,
|
bookAmount = informationData.BookPrice + informationData.DesignPrice,
|
||||||
bookName = informationData.BookEnglishName,
|
bookName = informationData.BookEnglishName,
|
||||||
bookDiscount = informationData.DiscountPrice,
|
bookDiscount = informationData.DiscountPrice,
|
||||||
count = 1,
|
count = 1,
|
||||||
previewImage = bytes
|
previewImage = bytes[0],
|
||||||
|
designImage = bytes[1]
|
||||||
};
|
};
|
||||||
ShoppingCartManager.Instance.AddToCart(cartData);
|
ShoppingCartManager.Instance.AddToCart(cartData);
|
||||||
UIManager.Instance.ShowUIOnly(nameof(ShoppingCartUI));
|
UIManager.Instance.ShowUIOnly(nameof(ShoppingCartUI));
|
||||||
|
|
Loading…
Reference in New Issue