游戏开发中常见系统梳理之背包系统的实现一

2024-01-21

游戏中几乎都存在大大小小的背包系统,接下来我将讲述背包系统具体是如何实现的(完整源码)

以下是使用unity+NGUI实现(使用txt配置的方法,后续更新UGUI+Json实现的背包系统敬请期待!)

背包中的物品我们常常将其制作成预设体,通过改变预设体图片来产生不同的物品,以下是物品以及管理格子系统的逻辑:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEditor.Progress;

/// <summary>
/// 一个用于控制背包內物品的类
/// </summary>

public class InventoryItem : UIDragDropItem
{
    //关联物品的图片
    public UISprite sprite;
    private int id;
    //关联显示窗口
    public UISprite tipWindow1;
    public UIButton tipbtnOk;
    public UIButton tipbtnCancel;
    
    void Update()
    {

        if (isHover)
        {
            //显示提示信息
           InventoryDes._instance.Show(id);
            if(Input.GetMouseButtonDown(1))
            {
                //按下鼠标右键开始穿戴
                //显示窗口
                tipWindow1.gameObject.SetActive(true);
                tipbtnOk.onClick.Add(new EventDelegate(() =>
                {
                    bool success = EquipmentUI._instance.Dress(id);
                    if(success)
                    {
                        transform.parent.GetComponent<InventoryItemGrid>().MinusNumber();
                    }
                    tipWindow1.gameObject.SetActive(false);
                }));
                tipbtnCancel.onClick.Add(new EventDelegate(() =>
                {
                    tipWindow1.gameObject.SetActive(false);
                }));
               

            }
        }
    }
  

    protected override void OnDragDropRelease(GameObject surface)
    {
        base.OnDragDropRelease(surface);

        //测试
        if (surface != null)
        {
            if (surface.tag == Tags.inventory_item_grid)
            {
                //拖放至空格子里面
                if (surface == this.transform.parent.gameObject)
                {
                    //拖放在自己的格子里面

                }
                else
                {
                    InventoryItemGrid oldParent = this.transform.parent.GetComponent<InventoryItemGrid>();

                    this.transform.parent = surface.transform;
                    //zhuyi
                    ResetPosition();
                    InventoryItemGrid newParent = surface.GetComponent<InventoryItemGrid>();

                    newParent.SetId(oldParent.id, oldParent.num);
                    oldParent.ClearInfo();
                }

            }
            else if (surface.tag == Tags.inventory_item)
            {
                //拖放在有物品的格子里面
                InventoryItemGrid grid1 = this.transform.parent.GetComponent<InventoryItemGrid>();
                InventoryItemGrid grid2 = surface.transform.parent.GetComponent<InventoryItemGrid>();
                int id = grid1.id; int num = grid1.num;

                grid1.SetId(grid2.id, grid2.num);
                grid2.SetId(id, num);
            }
            else if(surface.tag==Tags.shortcut)
            {
                //拖动到快捷栏当中
                surface.GetComponent<ShortCutGrid>().SetInventory(id);
               
            }
        }
        else
        {

        }
        ResetPosition();
    }
    //重置位置
    void ResetPosition()
    {
        transform.localPosition = Vector3.zero;
    }

    //注意这里
    //public void SetId(int id)
    //{
    //    ObjectInfo info=ObjectsInfo._instance.GetObjectInfoById(id);
    //    sprite.spriteName = info.icon_name;
    //}
    public void SetIconName(int id, string icon_name)
    {
        sprite.spriteName = icon_name;
        this.id = id;
    }
    //public void SetIconName(string icon_name)
    //{
    //    if (icon_name == null)
    //    {
    //        sprite.spriteName = "Icon-potion1";
    //        Debug.Log("null");
    //    }
    //    else
    //         Debug.Log("NOT NULL" + icon_name);
    //     // sprite.spriteName = icon_name;
    //}
    private bool isHover = false;
    public void OnHoverOver()
    {
        isHover = true;
    }
    public void OnHoverOut()
    {
        isHover = false;
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 一个用于管理背包內所有格子的类
/// </summary>
public class Inventory : MonoBehaviour
{
    public static Inventory _instance;
    private TweenPosition tween;
    //定义金币的数量 初始化为1000
    private int coinCount = 1000;
    //使用List将格子们存储起来
    public List<InventoryItemGrid> itemGridList = new List<InventoryItemGrid>();
    //关联金币文本,控制数量
    public UILabel coinNumberLabel;
    public GameObject inventoryItem;
    //关联背包的显示和隐藏(按钮)
    public UIButton btnBag;
    public UIButton btnClose;
    private bool isShow=false;

    void Awake()
    {
        _instance = this;
        tween=this.GetComponent<TweenPosition>();
    }
    private void Start()
    {
        btnBag.onClick.Add(new EventDelegate(() =>
        {
            Show();
        }));
        btnClose.onClick.Add(new EventDelegate(() =>
        {
            Hide();
        }));
    }
    public void Show()
    {
        isShow=true;
        tween.PlayForward();
    }
    public void Hide()
    {
        isShow=false;
        tween.PlayReverse();
    }
    public void TransformState()
    {
        if(isShow==false)
        {
            Show();
        }
        else
        {
            Hide();
        }

    }
    //增加金币的方法
    public void AddCoin(int count)
    {
        coinCount += count;
        coinNumberLabel.text = coinCount.ToString();//更新金币的显示
    }

    //取款方法
    public bool GetCoin(int count)
    {
        if(coinCount>=count)
        {
            coinCount-=count;
            coinNumberLabel.text = coinCount.ToString();//更新金币显示
            return true;
        }
        return false;
    }

    //测试背包系统的方法
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            GetId(Random.Range(2001,2023));
        }
    }

    //拾取到物品 添加到物品栏里面
    //处理拾取物品的功能
    public void GetId(int id,int count=1)
    {
        //查找所有物品中是否存在该物品
        //存在就数量+1

         InventoryItemGrid grid = null;
        foreach (InventoryItemGrid temp in itemGridList)
        {
            if (temp.id == id)
            {
                grid = temp;
                break;
            }
        }
        if (grid != null)
        {
            grid.PlusNumber(count);
        }
        else
        {
            //不存在的情况
            foreach (InventoryItemGrid temp in itemGridList)
            {
                if (temp.id == 0)
                {
                    grid = temp;
                    break;
                }
            }
            //不存在就放在空的格子里面
            if (grid != null)
            {
                GameObject itemGo = NGUITools.AddChild(grid.gameObject, inventoryItem);
                itemGo.transform.localPosition = Vector3.zero;
                itemGo.GetComponent<UISprite>().depth = 4;
                grid.SetId(id,count);
            }
        }
    }

    public bool MinusId(int id,int count=1)
    {
       
        InventoryItemGrid grid=null;
        foreach(InventoryItemGrid temp in itemGridList)
        {
            if (temp.id == id)
            {
                grid = temp;
                break;
            }
        }
        if (grid == null)
        { 
            return false; 
        }
        else
        {
            bool isSuccess = grid.MinusNumber(count);
            return isSuccess;
        }
    }
}

与物品相关的就是物品的描述了,将鼠标移动到物品上面时就会显示物品的信息,那么物品显示又应该怎么制作呢?废话不多说,直接上代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 一个用于控制物品信息显示的类
/// </summary>
public class InventoryDes : MonoBehaviour
{
    public static InventoryDes _instance;
    public UILabel label;
    //计时器
    private float timer = 0;

    void Awake()
    {
        _instance = this;

        this.gameObject.SetActive(false);
    }
    void Update()
    {
        if (this.gameObject.activeInHierarchy == true)
        {
            timer -= Time.deltaTime;
            if (timer <= 0)
            {
                this.gameObject.SetActive(false);
            }
        }
    }
    //显示的方法
    public void Show(int id)
    {
        this.gameObject.SetActive(true);
        timer = 0.1f;
        transform.position = UICamera.currentCamera.ScreenToWorldPoint(Input.mousePosition);
        ObjectInfo info = ObjectsInfo._instance.GetObjectInfoById(id);
        string des = "";
        switch (info.type)
        {
            case ObjectType.Drug:
                des = GetDrugDes(info);
                break;
            case ObjectType.Equip:
                des = GetEquipDes(info);
                break;
        }
        //更新显示
        label.text = des;
    }
    string GetDrugDes(ObjectInfo info)
    {
        string str = "";
        str +="名称:" + info.name + "\n";
        str += "+HP:" + info.hp + "\n";
        str += "+MP:" + info.mp + "\n";
         str += "出售价:" + info.price_sell + "\n";
        str += "购买价:" + info.price_buy;
        return str;
    }

    string GetEquipDes(ObjectInfo info)
    {
        string str = "";
        str += "名称" + info.name + "\n";
        switch(info.dressType)
        {
            case DressType.Headgear:
                str += "穿戴类型:头盔\n";
                break;
            case DressType.Armor:
                str += "穿戴类型:盔甲\n";
                break;
            case DressType.LeftHand:
                str += "穿戴类型:左手\n";
                break;
           case DressType.RightHand:
                str += "穿戴类型:右手\n";
                break;
            case DressType.Shoe:
                str += "穿戴类型:鞋\n";
                break;
            case DressType.Accessory:
                str += "穿戴类型:饰品\n";
                break;

        }
        switch(info.applicationType)
        {
            case ApplicationType.Swordman:
                str += "适用类型:剑士\n";
                break;
            case ApplicationType.Magician:
                str += "适用类型:魔法师\n";
                break;
            case ApplicationType.Common:
                str += "适用类型:通用\n";
                break;
        }
        str += "伤害值:" + info.attack + "\n";
        str += "防御值:" + info.def + "\n";
        str += "速度值:" + info.speed + "\n";
        return str;
    }
}

格子的逻辑:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 一个用于控制背包单个格子的类
/// </summary>
public class InventoryItemGrid : MonoBehaviour
{
    public static InventoryItemGrid _instance;
    public int id = 0;
    private ObjectInfo info = null;
    public int num = 0;
    public UILabel numLabel;

    void Awake()
    {
        _instance = this;
        //一开始隐藏文本
        numLabel.enabled= false;
    }

    public void SetId(int id, int num = 1)
    {
        this.id = id;
        info = ObjectsInfo._instance.GetObjectInfoById(id);

       InventoryItem item = this.GetComponentInChildren<InventoryItem>();

      
        item.SetIconName(id, info.icon_name);
       
            numLabel.enabled = true;
        this.num = num;
        numLabel.text = num.ToString();
    }
    public void PlusNumber(int num = 1)
    {
       
            this.num += num;
            //更新显示
            numLabel.text = this.num.ToString();
       
    }

    //用于减去数量的  表示装备是否减去成功
    public bool MinusNumber(int num=1)
    {
        
        if(this.num>=num)
        {
            this.num -= num;
            numLabel.text = this.num.ToString();
            if(this.num==0)
            {
                //清空物品
                ClearInfo();
                GameObject.Destroy(this.GetComponentInChildren<InventoryItem>().gameObject);
            }
            return true;
        }
        return false;
    }

    //public void PlusNumber(int num = 1)
    //{
    //    if (this.num < 10)
    //    {
    //        this.num = num + this.num;

    //        //更新显示
    //        numLabel.text = this.num.ToString();
    //        if (this.num <= 1)
    //            numLabel.enabled = false;
    //        else
    //            numLabel.enabled = true;
    //    }
    //}
    //设置一个清空的方法
    public void ClearInfo()
    {
        id = 0;
        info = null;
        num = 0;
        numLabel.enabled = false;
    }
}

其中最最重要的就是接下来的类了,一个关于物品信息的类,有了它才能操控背包系统正常运作,其中文本读取的是txt的文本,其中的定义规则你可以自己定义,然后拿给策划填写就可以了,注意不要空格!!!!而且符号是英文的符号,更重要的一点是你脚本里面写的一定要和策划填写的一样!如果出现报空错误一定要仔细检查txt文本是否有误,一定要让策划仔细检查三遍!!!!!(我之前是这样写的,结果我的其它协作者使用报错了,原因是策划期间修改了文本,并且没有仔细检查,所以大家一定要注意!)

以下是完整代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


/// <summary>
/// 一个用于管理所有Object对象信息的类
/// </summary>
public class ObjectsInfo : MonoBehaviour
{
    public static ObjectsInfo _instance;
    //使用字典的方法存储起来  默认为空
    //使用ID拿取物品
    public Dictionary<int, ObjectInfo> objectInfoDict = new Dictionary<int, ObjectInfo>();
    //可读取文本
    public TextAsset objectsInfoListText;
    void Awake()
    {
        _instance = this;
        //测试是否成功
        ReadInfo();
       
    }

    /// <summary>
    /// 写一个向外界提供物品信息的方法
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public ObjectInfo GetObjectInfoById(int id)
    {
        ObjectInfo info = null;
        //根据ID获取信息
        objectInfoDict.TryGetValue(id, out info);
        return info;
    }

    //写一个读取的类
    void ReadInfo()
    {
        string text = objectsInfoListText.text;
        //拆分一行
        string[] strArray = text.Split('\n');
        //将每一行都拆分成一个一个的
        foreach (string str in strArray)
        {
            string[] proArray = str.Split(',');
            //new一个ObjectInfo存储物品信息
            ObjectInfo info = new ObjectInfo();
            //将文本一行内容一个一个读取,存到新new的对象里面去
            int id = int.Parse(proArray[0]);
            string name = proArray[1];
            string icon_name = proArray[2];
            string str_type = proArray[3];
            //首先定义一种类型
            ObjectType type = ObjectType.Drug;
            switch (str_type)
            {
                case "Drug":
                    type = ObjectType.Drug;
                    break;
                case "Equip":
                    type = ObjectType.Equip;
                    break;
                case "Mat":
                    type = ObjectType.Mat;
                    break;
                    //其它的物品种类就在后面添加即可
            }
            //存进去
            info.id = id; info.name = name; info.icon_name = icon_name; info.type = type;
            //药品系列赋值
            if (type == ObjectType.Drug)
            {
                int hp = int.Parse(proArray[4]);
                int mp = int.Parse(proArray[5]);
                int price_sell = int.Parse(proArray[6]);
                int price_buy = int.Parse(proArray[7]);
                //存进去
                info.hp = hp;
                info.mp = mp;
                info.price_sell = price_sell;
                info.price_buy = price_buy;
            }

            //装备系列赋值
            if(type==ObjectType.Equip)
            {
                info.attack = int.Parse(proArray[4]);
                info.def = int.Parse(proArray[5]);
                info.speed = int.Parse(proArray[6]);
                info.price_sell = int.Parse(proArray[9]);
                info.price_buy = int.Parse(proArray[10]);
                string str_dresstype = proArray[7];
                switch(str_dresstype)
                {
                    case "Headgear":
                        info.dressType = DressType.Headgear;
                        break;
                    case "Armor":
                        info.dressType = DressType.Armor;
                        break;
                    case "LeftHand":
                        info.dressType = DressType.LeftHand;
                        break;
                    case "RightHand":
                        info.dressType = DressType.RightHand;
                        break;
                    case "Shoe":
                        info.dressType = DressType.Shoe;
                        break;
                    case "Accessory":
                        info.dressType = DressType.Accessory;
                        break;
                }
                string str_apptype = proArray[8];
                switch(str_apptype)
                {
                    case "Swordman":
                        info.applicationType = ApplicationType.Swordman;
                        break;
                    case "Magician":
                        info.applicationType = ApplicationType.Magician;
                        break;
                    case "Common":
                        info.applicationType = ApplicationType.Common;
                        break;
                }
            }
            //将他们添加到字典之中
            objectInfoDict.Add(id, info);
        }
    }
}

/// <summary>
/// 用于管理物品种类的枚举
/// 建立一个枚举 方便日后更多品种的物品信息添加
/// </summary>
public enum ObjectType
{
    //药品系列
    Drug,
    Equip,
    Mat
}

/// <summary>
/// 用于处理装备的信息
/// </summary>
public enum DressType
{
    Headgear,
    Armor,
    RightHand,
    LeftHand,
    Shoe,
    Accessory
}

/// <summary>
/// 用于处理不同类型的信息
/// </summary>
public enum ApplicationType
{
    Swordman,//剑士
    Magician,//魔法师
    Common//通用
}

/// <summary>
/// 一个用于管理单个物品信息的类
/// </summary>
public class ObjectInfo
{
    public int id; //索引值
    public string name;  //物品名字
    public string icon_name;   //物品加载的图片名字(存图集的名字)
    public ObjectType type;   //物品的种类
    public int hp;            //添加的HP值
    public int mp;            //添加的MP值
    public int price_sell;    //售卖的价格
    public int price_buy;    //卖出的价格(玩家)

    public int attack;
    public int def;
    public int speed;
    public DressType dressType;
    public ApplicationType applicationType;
}

以上是背包系统的完整代码,如果你直接复制发现了报错,那可能是因为我在里面关联了其它系统,找出来修改一下就好了,或者直接问我,核心的内容就是这些,希望对你有所帮助,点个赞支持一下吧!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

游戏开发中常见系统梳理之背包系统的实现一 的相关文章

  • 为什么 VB.NET 和 C# 中针对值检查 null 存在差异?

    In VB NET http en wikipedia org wiki Visual Basic NET有时候是这样的 Dim x As System Nullable Of Decimal Nothing Dim y As System
  • 如何使用 MVVM 更新 WPF 中编辑的数据? [复制]

    这个问题在这里已经有答案了 我正在为聊天应用程序构建 UI 设计 在尝试更新所选联系人的消息时遇到问题 选择现有联系人 选择编辑选项 然后编辑其属性 例如用户名和图像 后 唯一进行的更改是联系人的用户名和图像 我仍然想更改 MessageM
  • 是否允许将类模板类型参数键入相同的名称?

    这似乎可以在 MSVC 中按预期编译甚至工作 但它是合法的 C 代码吗 它是否能保证执行此处所期望的操作 即将模板类型导出到结构体的同名用户 template
  • 在Application_AquireRequestState事件中用POST数据重写Url

    我有一个在其中注册路线的代码Application AcquireRequestState应用程序的事件 注册路由后 我会在 Http 运行时缓存中设置一个标志 这样我就不会再次执行路由注册代码 在此事件中注册路线有特定原因Applicat
  • C# 中四舍五入到偶数

    我没有看到 Math Round 的预期结果 return Math Round 99 96535789 2 MidpointRounding ToEven returning 99 97 据我了解 MidpointRounding ToE
  • 为什么这个函数指针赋值在直接赋值时有效,但在使用条件运算符时无效?

    本示例未使用 include 在 MacOS10 14 Eclipse IDE 上编译 使用 g 选项 O0 g3 Wall c fmessage length 0 假设这个变量声明 int fun int 这无法通过 std touppe
  • 访问“if”语句之外的变量

    我怎样才能使insuranceCost以外可用if陈述 if this comboBox5 Text Third Party Fire and Theft double insuranceCost 1 在 if 语句之外定义它 double
  • 找到的程序集的清单定义与程序集引用不匹配

    我试图在 C Windows 窗体应用程序 Visual Studio 2005 中运行一些单元测试 但出现以下错误 System IO FileLoadException 无法加载文件或程序集 实用程序 版本 1 2 0 200 文化 中
  • 无法从 Web api POST 读取正文数据

    我正在尝试从新的 Asp Net Web Api 中的请求中提取一些数据 我有一个像这样的处理程序设置 public class MyTestHandler DelegatingHandler protected override Syst
  • 如何在编译C代码时禁用警告?

    我正在使用 32 位 Fedora 14 系统 我正在使用编译我的源代码gcc 有谁知道如何在编译c代码时禁用警告 EDIT 是的 我知道 最好的办法是修复这些警告以避免任何未定义 未知的行为 但目前在这里 我第一次编写了巨大的代码 并且在
  • Paradox 表 - Oledb 异常:外部表不是预期的格式

    我正在使用 Oledb 从 Paradox 表中读取一些数据 我遇到的问题是 当我将代码复制到控制台应用程序时 代码可以工作 但在 WinForms 中却不行 两者都以 x86 进行调试 我实际上只是复制代码 在 WinForms 应用程序
  • 更改 IdentityServer4 实体框架表名称

    我正在尝试更改由 IdentityServer4 的 PersistedGrantDb 和 ConfigurationDb 创建的默认表名称 并让实体框架生成正确的 SQL 例如 而不是使用实体IdentityServer4 EntityF
  • 在简单注入器中注册具有多个构造函数和字符串依赖项的类型

    我正在尝试弄清楚如何使用 Simple Injector 我在项目中使用了它 注册简单服务及其组件没有任何问题 但是 当组件具有两个以上实现接口的构造函数时 我想使用依赖注入器 public DAL IDAL private Logger
  • dropdownlist DataTextField 由属性组成?

    有没有一种方法可以通过 C 使 asp net 中的下拉列表的 datatextfield 属性由对象的多个属性组成 public class MyObject public int Id get set public string Nam
  • 如何用 C 语言练习 Unix 编程?

    经过五年的专业 Java 以及较小程度上的 Python 编程并慢慢感觉到我的计算机科学教育逐渐消失 我决定要拓宽我的视野 对世界的一般用处 并做一些 对我来说 感觉更重要的事情就像我真的对机器有影响一样 我选择学习 C 和 Unix 编程
  • 使用(linq to sql)更新错误

    我有两个表 通过外键 CarrierID 绑定 Carrier CarrierID CarrierName CarrierID 1 CarrierName DHL CarrierID 2 CarrierName Fedex Vendor V
  • 如何访问窗口?

    我正在尝试使用其句柄访问特定窗口 即System IntPtr value Getting the process of Visual Studio program var process Process GetProcessesByNam
  • TPL 数据流块下游如何获取源生成的数据?

    我正在使用 TPL Dataflow 处理图像 我收到处理请求 从流中读取图像 应用多次转换 然后将生成的图像写入另一个流 Request gt Stream gt Image gt Image gt Stream 为此 我使用块 Buff
  • ASP.NET Core Razor Page 多路径路由

    我正在使用 ASP NET Core 2 0 Razor Pages 不是 MVC 构建系统 但在为页面添加多个路由时遇到问题 例如 所有页面都应该能够通过 abc com language 访问segment shop mypage 或
  • 在 C++ 和 Windows 中使用 XmlRpc

    我需要在 Windows 平台上使用 C 中的 XmlRpc 尽管我的朋友向我保证 XmlRpc 是一种 广泛可用的标准技术 但可用的库并不多 事实上 我只找到一个库可以在 Windows 上执行此操作 另外一个库声称 您必须做很多工作才能

随机推荐

  • 用Growly Draw for Mac,释放您的创意绘画天赋!

    在数字化时代 绘画已经不再局限于传统的纸笔之中 如今 我们可以借助强大的绘画应用软件 将创意化为独特的艺术作品 而Growly Draw for Mac就是一款让您能够快速释放创意 创作精美绘画作品的应用软件 Growly Draw for
  • 游戏开发之常见操作梳理——武器装备商店系统(NGUI版)

    游戏开发中经常出现武器商店 接下来为你们带来武器装备商店系统的具体解决办法 后续出UGUI Json版本 敬请期待 武器道具的具体逻辑 using System Collections using System Collections Ge
  • 游戏开发常见操作梳理之角色选择一

    进入游戏后 我们经常会进入角色选择的界面 通常是左右两个按钮可以更改角色供玩家选择 对于这种界面我们通常使用数据持久化将角色信息存储起来 接下来的笔记中 我将使用自带的数据持久化系统对其进行操作 实现角色的选择页面 后续会更新xml系列的文
  • Effective C++——尽可能使用const

    const允许指定一个语义约束 也就是指定一个 不该被改动 的对象 而编译器会强制实施这项约束 只要保持某个值不变是事实 就应该说出来 以获得编译器的协助 保证不被违反 const与指针 注意const的写法 const char p p可
  • 游戏开发常用实践操作之按动任意键触发

    接下来一些笔记会对于一些大大小小的实践操作进行记录 希望对你有所帮助 在游戏中 我们经常会遇到一些按动任意键触发的操作 接下来展示核心代码 以下是对于Unity中的操作 使用的UI是NGUI 对于核心操作没有影响 你可以自己置换 void
  • 游戏开发常见操作系列之敌人系统的开发一(U3D)

    在开发游戏的过程中 我们常常会出现一些敌人攻击我们玩家 并且实现掉血以及死亡的现象 敌人还会源源不断地生成 这是怎么制作的呢 接下来为大家提供方法 其中使用了NGUI 后续会更新其它方法 敬请期待 使用HUDText实现扣血时显示文本 直接
  • 【C++】static_cast和dynamic_cast使用详解

    目录 一 static cast 二 dynamic cast 三 总结 如果这篇文章对你有所帮助 渴望获得你的一个点赞 一 static cast static cast 是 C 中的一种 类型转换操作符 用于执行编译时的类型转换 它主要
  • 探索Web开发的未来——使用KendoReact服务器组件

    Kendo UI 是带有jQuery Angular React和Vue库的JavaScript UI组件的最终集合 无论选择哪种JavaScript框架 都可以快速构建高性能响应式Web应用程序 通过可自定义的UI组件 Kendo UI可
  • 数据结构——排序

    前言 哈喽小伙伴们好久不见 也是顺利的考完试迎来了寒假 众所周知 不怕同学是学霸 就怕学霸放寒假 假期身为弯道超车的最佳时间 我们定然是不能懒散的度过 今天我们就一起来学习数据结构初阶的终章 七大排序 本文所有的排序演示都为升序排序 目录
  • 「实战应用」如何用DHTMLX Gantt构建类似JIRA式的项目路线图(二)

    DHTMLX Gantt 是用于跨浏览器和跨平台应用程序的功能齐全的Gantt图表 可满足项目管理应用程序的所有需求 是最完善的甘特图图表库 在web项目中使用DHTMLX Gantt时 开发人员经常需要满足与UI外观相关的各种需求 因此他
  • 【C++】__declspec含义

    目录 一 declspec dllexport 如果这篇文章对你有所帮助 渴望获得你的一个点赞 一 declspec dllexport declspec dllexport 是 Microsoft Visual C 编译器提供的一个扩展
  • 【计算机毕业设计】北京医疗企业固定资产管理系统的设计与实现 _4c4c1

    近年来 人们的生活方式以网络为主题不断进化 北京医疗企业固定资产管理就是其中的一部分 现在 无论是大型的还是小型的网站 都随处可见 不知不觉中已经成为我们生活中不可或缺的存在 随着社会的发展 除了对系统的需求外 我们还要促进经济发展 提高工
  • DevExpress Web Report Designer中文教程 - 如何自定义控件和表达式注册?

    获取DevExpress v23 2正式版下载 Q技术交流 909157416 自定义控件集成 DevExpress Reports中的自定义报表控件注册变得更加容易 为了满足web开发人员的需求 DevExpressv23 1 包括简化的
  • 「工业遥测」图表控件LightningChart在制造加工业中的应用

    LightningChart NET 完全由GPU加速 并且性能经过优化 可用于实时显示海量数据 超过10亿个数据点 LightningChart包括广泛的2D 高级3D Polar Smith 3D饼 甜甜圈 地理地图和GIS图表以及适用
  • DevExpress WinForms导航控件 - 交付更时尚、体验更好的业务应用(一)

    DevExpress WinForms的Side Navigation 侧边导航 和Nav Panel 导航面板 可以帮助客户交付完全可模仿UI体验的业务解决方案 这些体验在当今流行的应用程序中都可找到 DevExpress WinForm
  • 红警源代码居然开源!附Githu链接

    红警 或者更准确地说 应该称为 红色警戒 是大多数80后记忆中与游戏最深刻的联系之一 几乎每位80后都有一段难以忘怀的红警时光 这款游戏几乎成为许多人青春的代名词 在2000年之后 星际和红警几乎成为了每个网吧不可或缺的游戏 这款游戏是由当
  • 基于 Blinn-Phong 的高性能 Shader,支持阴影和环境反射

    引言 社区高产大户孙二喵同学今天给大家带来了全套的传统光照模型 Shader 并集成了 Cocos Creator 的光照 阴影和环境反射能力 让你在渲染效果和性能之间自由权衡 正文开始 Cocos Creator 引擎的 3D 渲染功能
  • 界面控件DevExpress WPF属性网格 - 让应用轻松显示编辑各种属性事件

    DevExpress WPF Property Grid 属性网格 灵感来自于Visual Studio Visual Studio启发的属性窗口 对象检查器 让在WPF应用程序显示和编辑任何对象的属性和事件变得更容易 P S DevExp
  • HTML概述、基本语法(表格整理、标签、基本结构)

    一 HTML概述 HTML指的是超文本标记语言 超文本 是指页面内可以包含图片 链接 声音 视频等内容 标记 标签 通过标记符号来告诉浏览器页面该如何显示 我们可以打开浏览器 右击页面 点击 查看网页源代码 来方便了解HTML标签通过浏览器
  • 游戏开发中常见系统梳理之背包系统的实现一

    游戏中几乎都存在大大小小的背包系统 接下来我将讲述背包系统具体是如何实现的 完整源码 以下是使用unity NGUI实现 使用txt配置的方法 后续更新UGUI Json实现的背包系统敬请期待 背包中的物品我们常常将其制作成预设体 通过改变