Merge remote-tracking branch 'origin/NewMaster' into AnHui_BaoShi

This commit is contained in:
李浩 2025-05-14 09:44:25 +08:00
commit 233afdc488
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,45 @@
using QFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XMLTool;
public class PlayerController : MonoSingleton<PlayerController>
{
private PlayerController() { }
public class HasDevice
{
public Device device;
public int count;
}
Dictionary<string, HasDevice> hasDevices = new Dictionary<string, HasDevice>();
public void DropDevice(string key, int count = 1)
{
if (hasDevices.ContainsKey(key))
{
hasDevices[key].count -= count;
if (hasDevices[key].count <= 0)
{
hasDevices.Remove(key);
}
}
}
public void PickDevice(string key, int count = 1)
{
if (hasDevices.ContainsKey(key))
{
hasDevices[(string)key].count += count;
}
else
{
hasDevices.Add(key, new HasDevice() { count = count, device = DeviceController.Instance.GetDevice(key) });
}
}
}

View File

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

View File

@ -58,6 +58,8 @@ namespace XMLTool
public string BoxColliderCenter { get; set; } public string BoxColliderCenter { get; set; }
public bool MeshCollider { get; set; } public bool MeshCollider { get; set; }
public int Count = -1;
} }