Merge remote-tracking branch 'origin/develop' into feature/HostAttack_Hoang

This commit is contained in:
VDH
2025-10-14 17:13:58 +07:00
22 changed files with 818 additions and 508 deletions
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
[System.Serializable]
public struct GShopBuyOption
{
public uint price; // Item price
public uint endTime; // End time (year/month/day/hour/minute/second)
public uint time; // Duration in seconds (0 = permanent)
public uint startTime; // Start time
public int type; // Time type: 0=permanent, 1=weekly, 2=monthly, -1=invalid
public uint day; // Day mask for weekly/monthly
public uint status; // Item status: 0=none, 1=hot, 2=new, 3=recommended, 4-12=discount levels, 13=sold out
public uint flag; // Additional flags
}
[System.Serializable]
public struct GShopItem
{
public int localId; // Localization ID
public int mainType; // Main category index
public int subType; // Sub-category index
public string icon; // Icon file path (128 chars)
public uint id; // Item object ID
public uint num; // Item quantity
public GShopBuyOption[] buy; // Up to 4 different pricing options
public string desc; // Item description (512 chars)
public string name; // Item display name (32 chars)
public uint idGift; // Gift item ID
public uint giftNum; // Gift quantity
public uint giftTime; // Gift duration
public uint logPrice; // Log price
public uint[] ownerNpcs; // NPCs that own this item (8 max)
}
[System.Serializable]
public struct GShopMainType
{
public string name; // Main category name (64 chars)
public List<string> subTypes; // Sub-category names
}
public class GShopData
{
public List<GShopItem> items;
public List<GShopMainType> mainTypes;
public uint timestamp;
public GShopData()
{
items = new List<GShopItem>();
mainTypes = new List<GShopMainType>();
timestamp = 0;
}
}
// Extension methods for BinaryReader
public static class BinaryReaderExtensions
{
public static string ReadString(this BinaryReader reader, int length)
{
byte[] bytes = reader.ReadBytes(length);
return System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0');
}
public static string ReadWideString(this BinaryReader reader, int length)
{
byte[] bytes = reader.ReadBytes(length * 2); // Wide chars are 2 bytes each
return System.Text.Encoding.Unicode.GetString(bytes).TrimEnd('\0');
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7a383c75c23026f4097fb53388429788
@@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class GShopLoader : MonoBehaviour
{
[Header("File Paths")]
public string gshopDataPath = "gshop.data";
public string gshop1DataPath = "gshop1.data";
[Header("Loaded Data")]
public GShopData primaryShop = new GShopData();
public GShopData secondaryShop = new GShopData();
void Start()
{
LoadGShopData();
}
public void LoadGShopData()
{
Debug.Log("=== Loading GShop Data ===");
// Load primary shop
if (LoadShopData(gshopDataPath, primaryShop))
{
Debug.Log($"Primary shop loaded: {primaryShop.items.Count} items, {primaryShop.mainTypes.Count} categories");
LogShopData("Primary Shop", primaryShop);
}
// Load secondary shop
if (LoadShopData(gshop1DataPath, secondaryShop))
{
Debug.Log($"Secondary shop loaded: {secondaryShop.items.Count} items, {secondaryShop.mainTypes.Count} categories");
LogShopData("Secondary Shop", secondaryShop);
}
}
private bool LoadShopData(string filePath, GShopData shopData)
{
try
{
string fullPath = Path.Combine(Application.streamingAssetsPath, filePath);
if (!File.Exists(fullPath))
{
Debug.LogError($"GShop file not found: {fullPath}");
return false;
}
using (FileStream fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
using (BinaryReader reader = new BinaryReader(fs))
{
// Read timestamp
shopData.timestamp = reader.ReadUInt32();
Debug.Log($"Timestamp: 0x{shopData.timestamp:X8}");
// Read number of items
int itemCount = reader.ReadInt32();
Debug.Log($"Item count: {itemCount}");
// Read all items
for (int i = 0; i < itemCount; i++)
{
GShopItem item = ReadGShopItem(reader);
shopData.items.Add(item);
}
// Read 8 main types
for (int i = 0; i < 8; i++)
{
GShopMainType mainType = ReadGShopMainType(reader);
shopData.mainTypes.Add(mainType);
}
}
return true;
}
catch (Exception e)
{
Debug.LogError($"Error loading GShop data from {filePath}: {e.Message}");
return false;
}
}
private GShopItem ReadGShopItem(BinaryReader reader)
{
GShopItem item = new GShopItem();
item.localId = reader.ReadInt32();
item.mainType = reader.ReadInt32();
item.subType = reader.ReadInt32();
// Read icon path (128 chars)
item.icon = reader.ReadString(128);
item.id = reader.ReadUInt32();
item.num = reader.ReadUInt32();
// Read buy options (4 options)
item.buy = new GShopBuyOption[4];
for (int i = 0; i < 4; i++)
{
item.buy[i] = new GShopBuyOption
{
price = reader.ReadUInt32(),
endTime = reader.ReadUInt32(),
time = reader.ReadUInt32(),
startTime = reader.ReadUInt32(),
type = reader.ReadInt32(),
day = reader.ReadUInt32(),
status = reader.ReadUInt32(),
flag = reader.ReadUInt32()
};
}
// Read description (512 wide chars)
item.desc = reader.ReadWideString(512);
// Read name (32 wide chars)
item.name = reader.ReadWideString(32);
item.idGift = reader.ReadUInt32();
item.giftNum = reader.ReadUInt32();
item.giftTime = reader.ReadUInt32();
item.logPrice = reader.ReadUInt32();
// Read owner NPCs (8 max)
item.ownerNpcs = new uint[8];
for (int i = 0; i < 8; i++)
{
item.ownerNpcs[i] = reader.ReadUInt32();
}
return item;
}
private GShopMainType ReadGShopMainType(BinaryReader reader)
{
GShopMainType mainType = new GShopMainType();
// Read main type name (64 wide chars)
mainType.name = reader.ReadWideString(64);
// Read number of sub-types
int subTypeCount = reader.ReadInt32();
mainType.subTypes = new List<string>();
// Read sub-types
for (int i = 0; i < subTypeCount; i++)
{
string subTypeName = reader.ReadWideString(64);
mainType.subTypes.Add(subTypeName);
}
return mainType;
}
private void LogShopData(string shopName, GShopData shopData)
{
Debug.Log($"=== {shopName} Information ===");
Debug.Log($"Timestamp: 0x{shopData.timestamp:X8}");
Debug.Log($"Total Items: {shopData.items.Count}");
Debug.Log($"Total Categories: {shopData.mainTypes.Count}");
// Log categories
Debug.Log("--- Categories ---");
for (int i = 0; i < shopData.mainTypes.Count; i++)
{
var category = shopData.mainTypes[i];
Debug.Log($"Category {i}: {category.name}");
foreach (var subType in category.subTypes)
{
Debug.Log($" - {subType}");
}
}
// Log first 10 items as sample
Debug.Log("--- Sample Items (First 10) ---");
int sampleCount = Mathf.Min(10, shopData.items.Count);
for (int i = 0; i < sampleCount; i++)
{
var item = shopData.items[i];
Debug.Log($"Item {i}:");
Debug.Log($" ID: {item.id}, Name: {item.name}");
Debug.Log($" MainType: {item.mainType}, SubType: {item.subType}");
Debug.Log($" Quantity: {item.num}");
Debug.Log($" Icon: {item.icon}");
Debug.Log($" Description: {item.desc}");
// Log buy options
for (int j = 0; j < 4; j++)
{
var buyOption = item.buy[j];
if (buyOption.price > 0)
{
Debug.Log($" Buy Option {j}: Price={buyOption.price}, Status={buyOption.status}");
}
}
if (item.idGift > 0)
{
Debug.Log($" Gift: ID={item.idGift}, Num={item.giftNum}");
}
}
Debug.Log($"=== End {shopName} Information ===");
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 20694866a3163b342953396044c25a4e
@@ -87,6 +87,7 @@ namespace PerfectWorld.Scripts.Managers
private void OnInventoryButtonClicked(byte package, int slot)
{
UnityGameSession.RequestCheckSecurityPassWd("");
var data = model.GetInventoryData(package);
if (data != null && data.TryGetValue(slot, out var itemData))
{
@@ -286,25 +286,25 @@ namespace PerfectWorld.Scripts.Managers
var t = data.GetType();
// Debug: Log all available fields and properties
Debug.Log($"[Inventory] Data type: {t.Name}");
// Debug.Log($"[Inventory] Data type: {t.Name}");
var fields = t.GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach (var f in fields)
{
Debug.Log($"[Inventory] Field: {f.Name} ({f.FieldType.Name})");
}
// foreach (var f in fields)
// {
// Debug.Log($"[Inventory] Field: {f.Name} ({f.FieldType.Name})");
// }
var props = t.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var p in props)
{
Debug.Log($"[Inventory] Property: {p.Name} ({p.PropertyType.Name})");
}
// foreach (var p in props)
// {
// Debug.Log($"[Inventory] Property: {p.Name} ({p.PropertyType.Name})");
// }
var methods = t.GetMethods(BindingFlags.Public | BindingFlags.Instance);
foreach (var m in methods)
{
if (m.Name.ToLower().Contains("name") || m.Name.ToLower().Contains("getname"))
{
Debug.Log($"[Inventory] Method: {m.Name} ({m.ReturnType.Name})");
}
}
// foreach (var m in methods)
// {
// if (m.Name.ToLower().Contains("name") || m.Name.ToLower().Contains("getname"))
// {
// Debug.Log($"[Inventory] Method: {m.Name} ({m.ReturnType.Name})");
// }
// }
// Prefer decoding the raw fields first to control encoding (Unicode for Vietnamese),
// then fall back to any string properties if needed.
@@ -56,7 +56,7 @@ namespace PerfectWorld.Scripts.Managers
{
Debug.Log("MATTERINFO");
//ENABLE LATER: It fetch all matters in the game world, causing performance issues
//OnMsgMatterInfo(Msg);
OnMsgMatterInfo(Msg);
break;
}
case int value when value == EC_MsgDef.MSG_MM_MATTERENTWORLD:
@@ -83,9 +83,9 @@ namespace PerfectWorld.Scripts.Managers
// Parse the data structure: count + info_matter array
int offset = 0;
// Read count (int)
int count = BitConverter.ToInt32(data, offset);
offset += sizeof(int);
// Read count (ushort)
ushort count = BitConverter.ToUInt16(data, offset);
offset += sizeof(ushort);
Debug.Log($"MATTERINFO: Received {count} matter entries");
@@ -136,6 +136,13 @@ namespace PerfectWorld.Scripts.Managers
private void SpawnMatterCube(int matterId)
{
// Check if matter is within 1000 units of the host player
/*if (!IsMatterWithinPlayerRange(matterId, 10000f))
{
Debug.Log($"Matter {matterId} is too far from player, skipping spawn");
return;
}*/
// Find the pickupItem component in the scene and create cube for this specific matter
pickupItem pickupScript = UnityEngine.Object.FindFirstObjectByType<pickupItem>();
if (pickupScript != null)
@@ -150,6 +157,13 @@ namespace PerfectWorld.Scripts.Managers
private void NotifyPickupItem(int matterId)
{
// Check if matter is within 1000 units of the host player
if (!IsMatterWithinPlayerRange(matterId, 1000f))
{
Debug.Log($"Matter {matterId} is too far from player, skipping notification");
return;
}
// Find the pickupItem component in the scene and update cubes
pickupItem pickupScript = UnityEngine.Object.FindFirstObjectByType<pickupItem>();
if (pickupScript != null)
@@ -157,6 +171,43 @@ namespace PerfectWorld.Scripts.Managers
pickupScript.UpdateMatterCubes();
}
}
/// <summary>
/// Check if a matter is within the specified distance from the host player
/// </summary>
/// <param name="matterId">The matter ID to check</param>
/// <param name="maxDistance">Maximum distance in Unity units</param>
/// <returns>True if matter is within range, false otherwise</returns>
private bool IsMatterWithinPlayerRange(int matterId, float maxDistance)
{
// Get the matter data
if (!matterDataStorage.TryGetValue(matterId, out info_matter matterData))
{
Debug.LogWarning($"Matter data not found for ID: {matterId}");
return false;
}
// Get the host player
var hostPlayer = GameController.Instance?.GetHostPlayer();
if (hostPlayer == null)
{
Debug.LogWarning("Host player not found");
return false;
}
// Convert matter position to Unity Vector3
Vector3 matterPosition = new Vector3(matterData.pos.x, matterData.pos.y, matterData.pos.z);
// Get player position
Vector3 playerPosition = hostPlayer.transform.position;
// Calculate distance
float distance = Vector3.Distance(matterPosition, playerPosition);
Debug.Log($"Matter {matterId} distance from player: {distance:F2} units (max: {maxDistance})");
return distance <= maxDistance;
}
// Public methods for players to access matter data
public info_matter? GetMatterData(int matterId)
@@ -915,7 +915,7 @@ namespace CSNetwork.GPDataType
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_matter_info_list
{
public int count;
public ushort count;
public info_matter Info;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@@ -253,6 +253,7 @@ namespace CSNetwork
_logger.Log(LogType.Info, "Send loop finished.");
}
private int _previousLength;
// Internal task to read from network and process data
private async Task ProcessReceivedData(CancellationToken token)
{
@@ -303,6 +304,9 @@ namespace CSNetwork
_receiveOctets.Capacity - currentBufferLength,
token
);
// _logger.Log(LogType.Info, $"ProcessReceivedData:: Buffer remaining data size: {currentBufferLength} -- Raw first byte: {_receiveOctets.RawBuffer[0]}");
}
catch (IOException ex)
when (ex.InnerException is SocketException se
@@ -334,10 +338,10 @@ namespace CSNetwork
currentBufferLength += bytesRead;
_receiveOctets.SetSize(currentBufferLength);
_logger.Log(LogType.Info, $"Process Buffer:: Read {bytesRead} bytes -- Token: {token.GetHashCode()}");
_logger.Log(LogType.Info, $"BF Process Buffer:: Read {bytesRead} bytes -- Total size: {currentBufferLength}");
// Process the data currently in the buffer
ProcessBuffer();
_logger.Log(LogType.Info, $"AF Process Buffer:: Read {bytesRead} bytes -- Total size: {currentBufferLength}");
// After processing, the buffer might have been compacted, update length
currentBufferLength = _receiveOctets.Length;
}
@@ -386,8 +390,10 @@ namespace CSNetwork
0,
originalBlockLength
);
_logger.Log(LogType.Info, $"ProcessBuffer:: raw first byte {currentData.RawBuffer[0]} - Length: {currentData.Length}");
// Update returns a NEW Octets object with processed data
dataToProcess = currentIsec!.Update(currentData);
_logger.Log(LogType.Info, $"ProcessBuffer:: decompressed first byte {dataToProcess.RawBuffer[0]} - Length: {dataToProcess.Length}");
// _logger.Log(LogType.Info, $"Input security applied. Original size: {originalBlockLength}, Processed size: {dataToProcess.Length}");
}
catch (Exception ex)
@@ -411,6 +417,7 @@ namespace CSNetwork
bool processedAnyProtocols = false;
int totalConsumedFromProcessedStream = 0; // Track total bytes consumed *from the processed stream*
Protocol._logger = _logger;
while (processingStream.Position < dataToProcess.Length)
{
int streamPosBeforeDecode = processingStream.Position;
@@ -418,6 +425,7 @@ namespace CSNetwork
try
{
//_logger.Log(LogType.Info, $"First byte of the stream: {processingStream.RawBuffer[0]}");
(p, consumedBytes) = Protocol.Decode(processingStream, IgnoreBytes); // Decode returns protocol and bytes consumed
}
catch (Exception e)
@@ -8,7 +8,7 @@ namespace CSNetwork.Protocols
{
public abstract class Protocol
{
private static readonly IPrefixedLogger _logger = LoggerFactory.GetLogger(nameof(Protocol));
public static IPrefixedLogger _logger = LoggerFactory.GetLogger(nameof(Protocol));
public uint Type { get; protected set; }
public ProtocolType GetPType() => (ProtocolType)Type;
private static readonly Dictionary<uint, Type> _protocolMap = new Dictionary<uint, Type>();
@@ -169,7 +169,7 @@ namespace CSNetwork.Protocols
private const int MaxProtocolSize = 16 * 1024 * 1024; // 16MB max size
public virtual string ToString => $"Protocol Type: {Type}";
public virtual string ToString => $"Protocol Type: {Type}";
}
// Add interface for marshallable objects
@@ -45,6 +45,8 @@ namespace CSNetwork.Security
{
if (data == null || data.Length == 0)
{
_logger.Log(LogType.Debug,$"HoangDev: AF _arcFour data{data.RawBuffer[0]} - Length: {data.Length}");
return new Octets(); // Return empty if input is empty
}
// 1. Decrypt using ARCFour
@@ -55,7 +57,9 @@ namespace CSNetwork.Security
// or just to be safe. Ensure _arcFour.Update returns a *new* Octets.
// *** If ARCFourSecurity.Update modified the input Octets in-place, this would be wrong. ***
// *** Assuming ARCFourSecurity.Update follows the abstract Security pattern and returns new Octets ***
decryptedData = _arcFour.Update(data);
decryptedData = _arcFour.Update(data);
_logger.Log(LogType.Debug,$"HoangDev: AF _arcFour data{decryptedData.RawBuffer[0]} - Length: {decryptedData.Length}");
}
catch (Exception ex)
{
@@ -75,7 +79,7 @@ namespace CSNetwork.Security
try
{
decompressedData = decompressor.Update(decryptedData);
//_logger.Log(LogType.Debug, $"Decompressed {decryptedData.Length} bytes to {decompressedData.Length} bytes. Decompressed Data: {decompressedData.ToString()}");
_logger.Log(LogType.Debug, $"Decompressed {decryptedData.Length} bytes to {decompressedData.Length} bytes. Decompressed Data: {decompressedData.ToString()}");
}
catch (Exception ex)
{
@@ -156,6 +156,10 @@ namespace BrewMonster.Network
{
Instance._gameSession.RequestDropIvtrItem(index, amount);
}
public static void RequestCheckSecurityPassWd(string password)
{
Instance._gameSession.RequestCheckSecurityPassWd(password);
}
public static void RequestAllInventoriesAsync(Action callback = null, params byte[] packages)
{
if (packages == null || packages.Length == 0)
@@ -35,6 +35,9 @@ namespace BrewMonster.UI
{
_loginButton.onClick.AddListener(OnLoginButtonClicked);
context = SynchronizationContext.Current;
_usernameInputField.text = PlayerPrefs.GetString("username", "");
_passwordInputField.text = PlayerPrefs.GetString("password", "");
}
// Update is called once per frame
@@ -67,6 +70,9 @@ namespace BrewMonster.UI
string username = _usernameInputField.text;
string password = _passwordInputField.text;
UnityGameSession.SetConnectionInfo("103.182.22.52", 29000);
PlayerPrefs.SetString("username", username);
PlayerPrefs.SetString("password", password);
PlayerPrefs.Save();
await UnityGameSession.Login(username, password, OnLoginComplete);
}
@@ -143,7 +149,7 @@ namespace BrewMonster.UI
await Task.Delay(2000);
// Request all known packages: 0=Inventory,1=Equipment,2=Task
UnityGameSession.RequestAllInventoriesAsync(() => { BMLogger.Log("Sent Inventory Detail Requests (all packs)"); }, 0, 1, 2);
UnityGameSession.RequestCheckSecurityPassWd("");
await Task.Delay(2000);
UnityGameSession.c2s_CmdGetAllData(true, true, false);
EC_Game.Init();
+31 -34
View File
@@ -10,9 +10,26 @@ using TMPro;
public class pickupItem : MonoBehaviour
{
public InputField mid;
public InputField tid;
public Button send;
// Singleton instance
private static pickupItem _instance;
public static pickupItem Instance
{
get
{
if (_instance == null)
{
_instance = FindFirstObjectByType<pickupItem>();
if (_instance == null)
{
// Create a new GameObject with pickupItem component if none exists
GameObject pickupManager = new GameObject("PickupManager");
_instance = pickupManager.AddComponent<pickupItem>();
DontDestroyOnLoad(pickupManager);
}
}
return _instance;
}
}
// Dictionary to store created cubes with their matter IDs
private Dictionary<int, GameObject> matterCubes = new Dictionary<int, GameObject>();
@@ -29,10 +46,17 @@ public class pickupItem : MonoBehaviour
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// Add button click listener
if (send != null)
// Ensure this is the singleton instance
if (_instance == null)
{
send.onClick.AddListener(OnPickupButtonClicked);
_instance = this;
DontDestroyOnLoad(gameObject);
}
else if (_instance != this)
{
// If another instance already exists, destroy this one
Destroy(gameObject);
return;
}
// Get reference to matter manager
@@ -148,7 +172,7 @@ public class pickupItem : MonoBehaviour
// Create cube GameObject
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.name = $"Matter_{matterData.Value.mid}_TID_{matterData.Value.tid}";
cube.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
cube.transform.localScale = new Vector3(1f, 1f, 1f);
// Position the cube based on matter position
Vector3 position = new Vector3(
matterData.Value.pos.x,
@@ -347,36 +371,9 @@ public class pickupItem : MonoBehaviour
return pickedUpItems.Count;
}
private void OnPickupButtonClicked()
{
// Validate input fields
if (mid == null || tid == null)
{
Debug.LogError("PickupItem: Mid or Tid InputField is not assigned!");
return;
}
// Parse the input values
if (int.TryParse(mid.text, out int midValue) && int.TryParse(tid.text, out int tidValue))
{
// Call the pickup item request
UnityGameSession.RequestPickupItem(midValue, tidValue);
Debug.Log($"Pickup request sent - MID: {midValue}, TID: {tidValue}");
}
else
{
Debug.LogError("PickupItem: Invalid input values. Please enter valid integers for MID and TID.");
}
}
private void OnDestroy()
{
// Clean up button listener
if (send != null)
{
send.onClick.RemoveListener(OnPickupButtonClicked);
}
// Clean up all matter cubes
foreach (var kvp in matterCubes)
{
File diff suppressed because it is too large Load Diff
+16 -53
View File
@@ -51859,6 +51859,7 @@ GameObject:
- component: {fileID: 683026977}
- component: {fileID: 683026976}
- component: {fileID: 683026975}
- component: {fileID: 683026978}
m_Layer: 5
m_Name: IvtrBtn
m_TagString: Untagged
@@ -51984,6 +51985,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 683026973}
m_CullTransparentMesh: 1
--- !u!114 &683026978
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 683026973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 24000eb1448ca674888f256f5508cadd, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!28 &683052458
Texture2D:
m_ObjectHideFlags: 0
@@ -59320,54 +59333,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 5834405183358786743, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3}
m_PrefabInstance: {fileID: 214042596392055003}
m_PrefabAsset: {fileID: 0}
--- !u!114 &752532604
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 752532602}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 12345678901234567890123456789012, type: 3}
m_Name:
m_EditorClassIdentifier:
inventoryPackButtons: []
equipmentPackButtons: []
fashionPackButtons: []
detailPanelRoot: {fileID: 0}
hideDetailOnStart: 1
nameText:
legacy: {fileID: 0}
tmp: {fileID: 0}
templateIdText:
legacy: {fileID: 0}
tmp: {fileID: 0}
countText:
legacy: {fileID: 0}
tmp: {fileID: 0}
slotText:
legacy: {fileID: 0}
tmp: {fileID: 0}
packageText:
legacy: {fileID: 0}
tmp: {fileID: 0}
stateText:
legacy: {fileID: 0}
tmp: {fileID: 0}
expireText:
legacy: {fileID: 0}
tmp: {fileID: 0}
crcText:
legacy: {fileID: 0}
tmp: {fileID: 0}
contentLenText:
legacy: {fileID: 0}
tmp: {fileID: 0}
equipButton: {fileID: 0}
dropButton: {fileID: 0}
autoRefresh: 1
refreshInterval: 1
--- !u!1 &755821556
GameObject:
m_ObjectHideFlags: 0
@@ -165671,13 +165636,11 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: -340
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 2043904448860146935, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3}
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 5910006447059157136, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3}
insertIndex: -1
addedObject: {fileID: 752532604}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
+13 -10
View File
@@ -404,20 +404,23 @@ public class CECHostPlayer : CECPlayer
{
case CommandID.PICKUP_ITEM:
{
// Parse the pickup item data from the server response
if (data != null && data.Length >= 16)
int tid = BitConverter.ToInt32(data, 0);
int expire_date = BitConverter.ToInt32(data, 4);
uint iAmount = BitConverter.ToUInt32(data, 8);
uint iSlotAmount = BitConverter.ToUInt32(data, 12);
byte byPackage = data[16];
byte bySlot = data[17];
Debug.Log($"[Inventory] PICKUP_ITEM: tid={tid}, expire_date={expire_date}, iAmount={iAmount}, iSlotAmount={iSlotAmount}, byPackage={byPackage}, bySlot={bySlot}");
// Notify pickupItem script about successful pickup
pickupItem pickupScript = pickupItem.Instance;
if (pickupScript != null)
{
int tid = BitConverter.ToInt32(data, 0);
int expire_date = BitConverter.ToInt32(data, 4);
uint iAmount = BitConverter.ToUInt32(data, 8);
uint iSlotAmount = BitConverter.ToUInt32(data, 12);
byte byPackage = data[16];
byte bySlot = data[17];
Debug.Log($"[Inventory] PICKUP_ITEM: tid={tid}, expire_date={expire_date}, iAmount={iAmount}, iSlotAmount={iSlotAmount}, byPackage={byPackage}, bySlot={bySlot}");
// Notify pickupItem script about successful pickup
pickupItem pickupScript = UnityEngine.Object.FindFirstObjectByType<pickupItem>();
pickupScript = UnityEngine.Object.FindFirstObjectByType<pickupItem>();
if (pickupScript != null)
{
pickupScript.OnPickupSuccess(tid);
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c41129e7ce0172646bfb09d0ddb30e97
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3225fad25b02b6d47ae09df59f44bbce
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: