psv中文输入,PSV暂时屏蔽滤镜,httpapi搜索处理部分

This commit is contained in:
sin365 2024-12-26 02:22:56 +08:00
parent fca038e67d
commit 62fbb6e11b
4 changed files with 426 additions and 383 deletions

View File

@ -20,6 +20,13 @@ namespace AxibugEmuOnline.Client
public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg) public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg)
{ {
#if UNITY_PSP2
m_filters = new List<Filter>();
m_filterRomSetting = new FilterRomSetting();
m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false);
return;
#endif
m_filters = new List<Filter> m_filters = new List<Filter>
{ {
new Filter(new FixingPixelArtGrille()), new Filter(new FixingPixelArtGrille()),
@ -38,13 +45,19 @@ namespace AxibugEmuOnline.Client
public Texture ExecuteFilterRender(Texture src) public Texture ExecuteFilterRender(Texture src)
{ {
if (result == null) if (result == null)
result = RenderTexture.GetTemporary(Screen.width, Screen.height); {
//result = RenderTexture.GetTemporary(Screen.width, Screen.height);
result = Initer.instance.renderTest;
}
else if (result.width != Screen.width || result.height != Screen.height) else if (result.width != Screen.width || result.height != Screen.height)
{ {
RenderTexture.ReleaseTemporary(result); //RenderTexture.ReleaseTemporary(result);
result = RenderTexture.GetTemporary(Screen.width, Screen.height); //result = RenderTexture.GetTemporary(Screen.width, Screen.height);
result = Initer.instance.renderTest;
} }
bool anyFilterEnable = false; bool anyFilterEnable = false;
foreach (var filter in Filters) foreach (var filter in Filters)
{ {

View File

@ -2,6 +2,7 @@ using AxibugEmuOnline.Client.ClientCore;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
@ -14,7 +15,27 @@ namespace AxibugEmuOnline.Client
public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10); public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10);
public delegate void SearchRomListAPI(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10); public delegate void SearchRomListAPI(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10);
public static string UrlEncode(string str)
{
StringBuilder sb = new StringBuilder();
foreach (char c in str)
{
if ((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
c == '-' || c == '_' || c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || c == ')')
{
sb.Append(c);
}
else
{
sb.Append('%').Append(((int)c).ToString("X2"));
}
}
return sb.ToString();
}
public void GetNesRomList(Action<Resp_GameList> callback, int page, int pageSize = 10) public void GetNesRomList(Action<Resp_GameList> callback, int page, int pageSize = 10)
{ {
App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback)); App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback));
@ -26,6 +47,13 @@ namespace AxibugEmuOnline.Client
} }
private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action<Resp_GameList> callback) private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action<Resp_GameList> callback)
{ {
//避免特殊字符和个别文字编码问题
byte[] gb2312Bytes = Encoding.Default.GetBytes(searchKey);
byte[] utf8Bytes = Encoding.Convert(Encoding.Default, Encoding.UTF8, gb2312Bytes);
// 将UTF-8编码的字节数组转换回字符串此时是UTF-8编码的字符串
string utf8String = Encoding.UTF8.GetString(utf8Bytes);
searchKey = UrlEncode(utf8String);
App.log.Info($"search->{utf8String} ->{searchKey}");
AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}"); AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}");
yield return request.SendWebRequest; yield return request.SendWebRequest;

View File

@ -18,9 +18,11 @@ public class SonyVitaCommonDialog : MonoBehaviour
Sony.Vita.Dialog.Ime.ImeDialogParams info = new Sony.Vita.Dialog.Ime.ImeDialogParams(); Sony.Vita.Dialog.Ime.ImeDialogParams info = new Sony.Vita.Dialog.Ime.ImeDialogParams();
// Set supported languages, 'or' flags together or set to 0 to support all languages. // Set supported languages, 'or' flags together or set to 0 to support all languages.
info.supportedLanguages = Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_JAPANESE | info.supportedLanguages = Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_SIMPLIFIED_CHINESE |
Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_JAPANESE |
Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_ENGLISH_GB | Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_ENGLISH_GB |
Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_DANISH; Sony.Vita.Dialog.Ime.FlagsSupportedLanguages.LANGUAGE_TRADITIONAL_CHINESE;
info.languagesForced = true; info.languagesForced = true;
info.type = Sony.Vita.Dialog.Ime.EnumImeDialogType.TYPE_DEFAULT; info.type = Sony.Vita.Dialog.Ime.EnumImeDialogType.TYPE_DEFAULT;

View File

@ -23,7 +23,7 @@ namespace AxibugEmuOnline.Client
public static void Input(Action<string> callback, string placeHolder, string defaultText) public static void Input(Action<string> callback, string placeHolder, string defaultText)
{ {
#if UNITY_PSP2 #if UNITY_PSP2 && !UNITY_EDITOR
App.sonyVitaCommonDialog.ShowPSVitaIME(callback, placeHolder, defaultText); App.sonyVitaCommonDialog.ShowPSVitaIME(callback, placeHolder, defaultText);
#else #else
s_ins.m_InputUI.Show(new ValueTuple<Action<string>, string, string>(callback, placeHolder, defaultText)); s_ins.m_InputUI.Show(new ValueTuple<Action<string>, string, string>(callback, placeHolder, defaultText));