目前个人网站做地最好是哪几家安卓app公司开发
2026/4/18 11:18:45 网站建设 项目流程
目前个人网站做地最好是哪几家,安卓app公司开发,网站建设网络门户,工程信息平台背景 写背包系统时点击物品格子#xff0c;出现详情页#xff0c;详情页的选项按钮根据物品种类、所属容器动态生成。这里生成选项按钮取决于的”键“有多个#xff1a;物品种类、所属容器#xff0c;执行的操作是生成几个按钮#xff0c;写入名称、添加回调。按常规思路…背景写背包系统时点击物品格子出现详情页详情页的选项按钮根据物品种类、所属容器动态生成。这里生成选项按钮取决于的”键“有多个物品种类、所属容器执行的操作是生成几个按钮写入名称、添加回调。按常规思路会写成2层判断一个长度恐怖的函数。改进经过豆包的启发双键可以使用Tupleswitch可以用硬编码字典case后面的操作可以用委托存放变成了这样一个硬编码字典虽然还是很长但是比原来的写法200多行已经好多了而且更整齐了。public class ButtonConfig { public string hint; public UnityAction callback; } DictionaryTupleCellLocation, Props_Type, ListButtonConfig buttonConfigs; buttonConfigs new() { //场景内物品选项 {Tuple.Create(CellLocation.Scene,Props_Type.Gun), new(){ new ButtonConfig { hint拾取,callback(){ TakeGunFromGround(cellSelected);} } } }, {Tuple.Create(CellLocation.Scene,Props_Type.Mag), new(){ new ButtonConfig { hint拾取,callback(){ PickMagFromScene(cellSelected);} } }}, {Tuple.Create(CellLocation.Scene,Props_Type.Medicine), new(){ new ButtonConfig { hint拾取,callback(){ PickFromScene(cellSelected);} } }}, {Tuple.Create(CellLocation.Scene,Props_Type.Grenade), new(){ new ButtonConfig { hint拾取,callback(){ PickFromScene(cellSelected);} } }}, //玩家背包内物品选项 {Tuple.Create(CellLocation.PlayerPack,Props_Type.Mag), new (){new ButtonConfig {hint放下,callback() { if (putIn){PutMagInCrate(cellSelected); }else{DropMag(cellSelected);} } } }}, {Tuple.Create(CellLocation.PlayerPack,Props_Type.Medicine), new (){new ButtonConfig {hint放下,callbackPutItem}, new ButtonConfig{hint使用,callbackTryUseMedicine} } }, {Tuple.Create(CellLocation.PlayerPack,Props_Type.Grenade), new(){ new ButtonConfig {hint放下,callback PutItem }, new ButtonConfig{hint使用,callbackTryUseGrenade } } }, //其他容器内物品选项 {Tuple.Create(CellLocation.OtherPack,Props_Type.Mag), new(){ new ButtonConfig {hint拾取,callback(){PickMagFromCrate(cellSelected);} }}}, {Tuple.Create(CellLocation.OtherPack,Props_Type.Medicine), new(){new ButtonConfig {hint拾取,callback(){PickFromCrate(cellSelected);} } } }, {Tuple.Create(CellLocation.OtherPack,Props_Type.Grenade), new(){new ButtonConfig {hint拾取,callback(){PickFromCrate(cellSelected);} } } }, {Tuple.Create(CellLocation.OtherPack,Props_Type.Gun), new(){ new ButtonConfig {hint拾取,callback() { TakeGunFromCrate(cellSelected); } } } } };

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询