Compare commits

...

2 Commits

Author SHA1 Message Date
舒荣森
fbacd20c4c Merge branch 'main' of http://192.168.2.19:3000/shurongsen/Cute_demon_attacks 2024-10-31 16:51:02 +08:00
舒荣森
9082a536ce add 2024-10-31 16:50:35 +08:00
9 changed files with 172 additions and 55 deletions

View File

@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 3337341073054923217} - component: {fileID: 3337341073054923217}
- component: {fileID: 3337341073054923214} - component: {fileID: 3337341073054923214}
- component: {fileID: 7112672788633924792} - component: {fileID: 7112672788633924792}
- component: {fileID: 8832094955958116167}
m_Layer: 5 m_Layer: 5
m_Name: InputField (Legacy) m_Name: InputField (Legacy)
m_TagString: Untagged m_TagString: Untagged
@ -168,6 +169,19 @@ MonoBehaviour:
m_FlexibleWidth: 50 m_FlexibleWidth: 50
m_FlexibleHeight: -1 m_FlexibleHeight: -1
m_LayoutPriority: 10 m_LayoutPriority: 10
--- !u!114 &8832094955958116167
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3337341073054923212}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b82c0068047f09c499145d4eb8ffb6d9, type: 3}
m_Name:
m_EditorClassIdentifier:
inputField: {fileID: 3337341073054923214}
--- !u!1 &3337341073515583678 --- !u!1 &3337341073515583678
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -355,6 +369,7 @@ MonoBehaviour:
textobj: {fileID: 3337341074074513327} textobj: {fileID: 3337341074074513327}
promptobj: {fileID: 3337341073515583678} promptobj: {fileID: 3337341073515583678}
contentobj: {fileID: 3337341074177666619} contentobj: {fileID: 3337341074177666619}
iconobj: {fileID: 0}
--- !u!1 &3337341074074513327 --- !u!1 &3337341074074513327
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -204,6 +204,7 @@ MonoBehaviour:
textobj: {fileID: 4246764786122325446} textobj: {fileID: 4246764786122325446}
promptobj: {fileID: 4246764787755305687} promptobj: {fileID: 4246764787755305687}
contentobj: {fileID: 4246764786287869010} contentobj: {fileID: 4246764786287869010}
iconobj: {fileID: 0}
--- !u!1 &4246764786122325446 --- !u!1 &4246764786122325446
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -398,6 +399,7 @@ GameObject:
- component: {fileID: 4246764787410611128} - component: {fileID: 4246764787410611128}
- component: {fileID: 4246764787410611111} - component: {fileID: 4246764787410611111}
- component: {fileID: 7335891663269242643} - component: {fileID: 7335891663269242643}
- component: {fileID: 8724552994600978160}
m_Layer: 5 m_Layer: 5
m_Name: InputField (Legacy) m_Name: InputField (Legacy)
m_TagString: Untagged m_TagString: Untagged
@ -553,6 +555,19 @@ MonoBehaviour:
m_FlexibleWidth: 10 m_FlexibleWidth: 10
m_FlexibleHeight: -1 m_FlexibleHeight: -1
m_LayoutPriority: 1 m_LayoutPriority: 1
--- !u!114 &8724552994600978160
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4246764787410611109}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b82c0068047f09c499145d4eb8ffb6d9, type: 3}
m_Name:
m_EditorClassIdentifier:
inputField: {fileID: 4246764787410611111}
--- !u!1 &4246764787755305687 --- !u!1 &4246764787755305687
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -306,6 +306,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b0d037404676f94408d73bb6199200aa, type: 3} m_Script: {fileID: 11500000, guid: b0d037404676f94408d73bb6199200aa, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
username: {fileID: 3011360594389648156}
--- !u!1 &304400296 --- !u!1 &304400296
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1796,3 +1797,14 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a8cc81ed2c5736a46a14628d8d489ac4, type: 3} m_SourcePrefab: {fileID: 100100000, guid: a8cc81ed2c5736a46a14628d8d489ac4, type: 3}
--- !u!114 &3011360594389648156 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3011360592512948003, guid: a8cc81ed2c5736a46a14628d8d489ac4, type: 3}
m_PrefabInstance: {fileID: 3011360594389648155}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -21,7 +21,10 @@ public struct Login
public string Phone; public string Phone;
} }
public struct GetListByPhone
{
public string Phone;
}

View File

@ -1,15 +1,40 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor.Hardware;
using UnityEditorInternal.VersionControl;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class InitInfo : MonoBehaviour public class InitInfo : MonoBehaviour
{ {
private MainObject parsedData;
private Username userdata;
public Text name;
// Start is called before the first frame update // Start is called before the first frame update
private async void Start() private async void Start()
{ {
string response = await web.SendRequest("http://47.109.133.52/Item/GetList", "POST"); string response = await web.SendRequest("http://47.109.133.52/Player/GetInfo", "POST");
Debug.Log(response); Debug.Log(response);
parsedData = JsonUtility.FromJson<MainObject>(response);
Debug.Log(parsedData.Info.Gold);
AssestPanel.instance.SetCoinText(parsedData.Info.Gold);
AssestPanel.instance.SetStoneText(parsedData.Info.Gem);
GetListByPhone getlistbyphone = new GetListByPhone();
getlistbyphone.Phone = "1";
string jsonString = JsonUtility.ToJson(getlistbyphone);
string userponse = await web.SendRequest("http://47.109.133.52/Player/GetListByPhone", "POST", jsonString);
Debug.Log(userponse);
userdata = JsonUtility.FromJson<Username>(userponse);
Debug.Log(userdata.ErrorCode);
//name.text=userdata.nameitem.Name;
} }
// Update is called once per frame // Update is called once per frame
@ -17,56 +42,44 @@ public class InitInfo : MonoBehaviour
{ {
} }
} }
public class MainObject
/// <summary>
/// 获取所有商品数据
/// </summary>
public class LevelUpNeedItem
{ {
public int Num; public Info Info;
public int Count;
}
public class LevelUpNeedThing
{
public int Gold;
public List<LevelUpNeedItem> Items;
}
public class Character
{
public int Num; // 角色编号
public string Name; // 角色名称
public float Hp; // 生命值
public float HpUpMul; // 生命值成长倍率
public float Attack; // 攻击力
public float AttackUpMul; // 攻击力成长倍率
public float Defense; // 防御力
public float DefenseUpMul; // 防御力成长倍率
public float AttackSpeed; // 攻击速度
public float AttackSpeedUpMul; // 攻击速度成长倍率
public float Move; // 移动速度
public float MoveUpMul; // 移动速度成长倍率
public List<int> Skill; // 技能ID列表
public int Attribute; // 角色属性
public string LevelUpNeedThingsJson; // 升级所需物品的JSON字符串
public string Expand; // 扩展字段(用于未来扩展或附加数据)
public int Type; // 角色类型
public int Rarity; // 角色稀有度
public string WeaponBulletEffectPath; // 武器子弹效果路径
public string WeaponBulletHitEffectPath; // 武器子弹命中效果路径
public int UltimateSkill; // 终极技能ID
public int Access; // 获取途径或可用性
public List<string> SellDate; // 售卖日期列表(如果适用)
}
public class CharacterListResponse
{
public List<Character> List;
public int ErrorCode; public int ErrorCode;
public string ErrorMessage; public string ErrorMessage;
} }
[Serializable]
public class Info
{
public string Id;
public int Gold;
public int Gem;
public string Phone;
public string Name;
}
public class Username
{
public List<nameitem> namelist;
public int ErrorCode;
public string ErrorMessage;
}
public class nameitem
{
public string Id;
public string Phone;
public string Name;
}

View File

@ -84,7 +84,7 @@ public class Logo_in : mount
if (root.ErrorMessage=="") if (root.ErrorMessage=="" && boxTypes[0].content!= "")
{ {
gameObject.SetActive(false); gameObject.SetActive(false);
Promptmgr.Instance.PromptBubble("登录成功"); Promptmgr.Instance.PromptBubble("登录成功");
@ -122,7 +122,6 @@ public class Logo_in : mount
{ {
// 这里使用场景管理器进行跳转 // 这里使用场景管理器进行跳转
SceneManager.LoadScene(JumpScene.main_scene); SceneManager.LoadScene(JumpScene.main_scene);
} }

View File

@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class InputUI : MonoBehaviour
{
public InputField inputField;
private void Start()
{
EventTrigger trigger = inputField.gameObject.AddComponent<EventTrigger>();
// 添加点击事件
EventTrigger.Entry clickEntry = new EventTrigger.Entry();
clickEntry.eventID = EventTriggerType.PointerClick;
clickEntry.callback.AddListener((data) => { HidePlaceholder(); });
trigger.triggers.Add(clickEntry);
// 添加鼠标离开事件
EventTrigger.Entry exitEntry = new EventTrigger.Entry();
exitEntry.eventID = EventTriggerType.PointerExit;
exitEntry.callback.AddListener((data) => { ShowPlaceholder(); });
trigger.triggers.Add(exitEntry);
}
private void HidePlaceholder()
{
if (inputField.placeholder != null)
{
inputField.placeholder.gameObject.SetActive(false);
}
}
private void ShowPlaceholder()
{
if (inputField.placeholder != null && string.IsNullOrEmpty(inputField.text))
{
inputField.placeholder.gameObject.SetActive(true);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b82c0068047f09c499145d4eb8ffb6d9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -11,6 +11,7 @@ public class AssestPanel : MonoBehaviour
public Text Ore; public Text Ore;
public Text Forging; public Text Forging;
void Start() void Start()
{ {
instance = this; instance = this;
@ -18,6 +19,8 @@ public class AssestPanel : MonoBehaviour
Forging.text=PlayerManager.Instance.Forging.ToString(); Forging.text=PlayerManager.Instance.Forging.ToString();
Coin.text=PlayerManager.Instance.Coins.ToString(); Coin.text=PlayerManager.Instance.Coins.ToString();
Ore.text=PlayerManager.Instance.Ore.ToString(); Ore.text=PlayerManager.Instance.Ore.ToString();
} }
public void SetStoneText(float num) public void SetStoneText(float num)
@ -49,4 +52,6 @@ public class AssestPanel : MonoBehaviour
Forging.text = num.ToString(); Forging.text = num.ToString();
} }
} }
} }