- 博客(37)
- 资源 (2)
- 收藏
- 关注
原创 P4 edit 文件目录时 有中文 导致失败
这个报错是这样的:我使用的命令是:因为这里用了中文所以一直在报错解决这个问题有两个方案p4 -Q cp936 edit “//Depot/副本.txt”p4 后面加上 -Q cp936 即可 使用中文编码这里要注意 路径要用双引号引起来p4 set P4COMMANDCHARSET=cp936在环境变量中设置中文编码...
2022-03-01 16:02:57 432
原创 C# 对象生存期与垃圾回收机制 《.NET之美:.NET关键技术深入解析》笔记
【CSND】Unity游戏开发学习群加入我们一起学习吧:1022366216对象生存期大家应该都熟悉值类型和引用类型,这两种类型的主要区别在于内存分配上,引用类型对象分配在托管堆上,而值类型则位于线程栈上。然而托管堆不可能无限大,分配于托管堆上的对象可能在使用完后就再也不会被访问了,因此,需要一种机制来销毁托管堆上的对象,以释放内存。在.NET中,这一过程被称作垃圾收集(Garbage collection)。注意:只有引用类型的对象才会分配在托管堆上,因此,只有引用类型的对象才需要进行垃圾收集,
2021-03-29 17:47:36 1089 1
原创 Unity 通过摄像机截图并把图篇保存
【CSND】Unity游戏开发学习群加入我们一起学习吧:1022366216using System.Collections;using System.Collections.Generic;using UnityEngine;public class ScreenShot : MonoBehaviour { public Camera targetCamera; void Update() { //鼠标右键按下,进行三种截图方式的调用
2021-03-26 14:42:03 1527
原创 动态控制动画机播放进度
/// <summary>/// 需要控制播放进度的动画机/// </summary>public abstract class RequireControlAnimator : MonoBehaviour{ /// <summary> /// 动画机 /// </summary> private Animator animator; /// <summary> /// 初始化动画机
2021-02-04 09:21:17 340
原创 数列 1,1,2,3,5,8,13...第 n 位数是多少?用 C#递归算法实现
static void Main(string[] args) { Console.WriteLine("请输入个正数:"); int Input = int.Parse(Console.ReadLine()); while (Input < 0) { Console.WriteLine("请输入个正数:"); Input =
2020-11-05 12:33:04 2167
转载 Unity 卡牌游戏中洗牌算法
void Refreshthecard(){ for(int i=0,i<GridIndex.Length;i++) { int r=Random.Range(i,GridIndex.Length); int temp=GridIndex[i]; GridIndex[i]=GridIndex[r]; GridIndex[r]=temp; }}
2020-09-04 20:33:25 684
原创 Unity 文件读写 (text)
using System.Collections;using System.Collections.Generic;using UnityEngine;using System.Text;using System.IO;public class textz : MonoBehaviour{ // Start is called before the first frame update void Start() { Load(); } /
2020-08-25 14:44:07 1532
原创 Unity 将Rotate 值转换为 Inspector面板的rotation值
有些时候可能会遇到想旋转到 Inspector面板上的rotation的值 但是因为四元数的和欧拉角的关系直接赋值是不能达到效果的下面这个函数就可以解决这个问题了 //获取到旋转的正确数值 public static Vector3 GetInspectorRotationValue(Transform transform) { System.Type transformType = transform.GetType(); PropertyInfo
2020-08-25 14:42:24 1664 1
原创 QT的基本图形绘制
1 引用 #include 2 创建绘制对象 QPainter *mQPainter;3 绘制对象初始化 mQPainter =new QPainter(); //全程使用一个绘图对象(构造)4 随机种子 qsrand(static_cast(time(nullptr))); //构造里5 随机数获得 qrand()%n;6 重写绘制函数 void paintEvent(QPaintEvent *event);7 void MainWindow::paintEvent(QPa
2020-08-25 11:01:14 437
原创 QT QMediaPlayer 播放视频
先创建一个label 然后视频将会显示在正中间 上下左右间隔为10的间隔播放时,将label向左移动10个单位,向上移动10个单位,宽度加10,高度加10,即可显示在正确区域。关于转码,只有转为本机识别的格式以后再打包,转到qt识别的格式,到别的机器才会通用解码播放,建议使用格式工厂,多转码,禁用解码器。//pro文件QT+=multimedia multimediawidgets头文件包含#include <QMultiMedia>#include <QVBoxLayo
2020-08-25 10:50:54 1375
原创 Unity 将相机画面绘制在屏幕上(小地图制作方法)
闲话少说 !直接上教程第一步:首先创建一个Camera (用来渲染模型)第二步:给新创建的Camera添加PhysicsRaycaster组件 没有这个组件没法接受射线第三步:给相机添加脚本//渲染相机 public Camera rtCamera; public float Width;//要显示在屏幕上的宽 public float Height;//要显示在屏幕上的高 private void Start() { //Camera.pixe
2020-08-17 16:32:55 960
原创 Unity 中的特定文件夹
在Unity项目的开发过程中,可以选择创建任意符合规范名称的文件夹来组成整个项目的目录结构。同时,Unity定义了一系列特定名称的文件夹处于处理指定任务,如必须将与编辑器相关的脚本放到Editor文件夹中才能正常工作。下面逐个介绍主要特定文件夹的具体功能AssetsAssets 文件夹包含了Unity项目中使用到的说有资源问价。新建Unity项目后,会自动创建该文件夹。在Project 面板中,Assets作为根目录使用,并且不需要明确的指明,所有的API方法默认全部的资源都位于Assets文件夹内。
2020-07-14 23:42:40 450
原创 Unity 学习笔记(三)——协程操作详解
协程的两种开启方式1.StartCoroutine(DoSomething());2.StartCoroutine(“DoSomething”);协程关闭1.StopCoroutine(DoSomething()); //关闭指定协程2.StopAllCoroutines(); //关闭所有协程 void Start() { StartCoroutine(DoSomething());//开启协程的第一种方法
2020-07-14 23:02:16 363
原创 Unity 常用方法整理
Unity 常用方法整理 //获取子物体方法 GameObject Child = transform.Find("Child").gameObject;//查找当前对象的子物体 “Child” GameObject Child1 = transform.GetChild(0).gameObject;//获取当前物体下第一个子物体 GameObject Child2 = GameObject.FindWithTag("Child2"); /
2020-07-14 22:49:34 807
原创 C#窗体(二)—鼠标长时间按下事件
鼠标长时间按下事件创建VS窗体应用程序具体代码如下using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace Mous
2020-07-14 10:25:39 2680
原创 C#窗口(一) —获取鼠标窗体坐标和屏幕坐标
主要实现 鼠标在窗体上移动时,程序将鼠标的窗体坐标和屏幕坐标实时的显示在窗体的标题栏上接下来开始实现功能首先 在VS上创建一个 C#窗体应用程序using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Ta
2020-07-14 10:01:42 9849 3
原创 Unity——简单实现“贪吃蛇”
简单实现 2D 贪吃蛇废话不多说直接上图上代码!第一步 先搞一个背景 创建一个Canvas 再Canvas 下在创建一个Image 命名为bg第二步 创建一个蛇头 在Canvas 下创建一个Image 命名为SnakeHead(SnakeHead要在bg后面 这样才可以显示在背景的上方第三步 实现蛇头的移动创建一个脚本 命名为SnakeHeadController将脚本挂载到SnakeHead上代码如下:using System.Collections;using System.Coll
2020-07-13 16:09:00 2856 4
原创 学习C#设计模式(十六)访问者模式
访问者者模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Visitor{ //抽象果农类 public abstract class Orchardist { public abstract void VisitApple(Apple apple);
2020-07-13 09:12:32 126
原创 学习C#设计模式(十五)中介者模式
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Mediator{ //抽象果园类 public abstract class Orchard { protected Orchardist orchardist; //果农实例引用
2020-07-13 09:07:37 238 1
原创 学习C#设计模式(十四)观察者模式
观察者模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Observer{ public interface IOrchard { void Add(IMonitor monitor);//添加监控员接口方法 void Remove(IMonitor
2020-07-13 09:02:48 99
原创 学习C#设计模式(十三)策略模式
策略模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Strategy{ //果园类 public class Orchard { Fruit fruit;//水果类引用 public Orchard(Fruit fruit) {
2020-07-13 08:44:00 132
原创 学习C#设计模式(十二)组合模式
组合模式using System;using System.Collections.Generic;namespace Composite{ //抽象地区类 public abstract class Area { protected string name; public Area(string name) { this.name = name; } public abstract void Add(Area area);
2020-07-12 18:51:15 123
原创 学习C#设计模式(十一)桥接模式
桥接模式using System;namespace Bridge{ //抽象水果类 public abstract class Fruit { public abstract void Plant();//抽象种植方法 } //苹果类 public class Apple : Fruit { //种植苹果 public override void Plant() {
2020-07-12 00:09:11 116
原创 学习C#设计模式(十)代理模式
代理模式using System;namespace Proxy{ //水果销售者 public abstract class FruitSeller { //抽象卖水果方法 public abstract int Sell(ref int money); } //果农 public class Orchardist : FruitSeller { //卖水果收入:元 int
2020-07-11 23:45:07 147
原创 学习C#设计模式(九)装饰者模式
装饰者模式using System;namespace Decorator{ //抽象水果类 public abstract class Fruit { public abstract void Plant(); } public class Apple : Fruit { //种植苹果树 public override void Plant() { Console
2020-07-11 23:13:05 105
原创 学习C#设计模式(八)适配器模式
适配器模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Adapter{ //种植接口 public interface IPlant { //种植水果 void Plant(); } public class Orchard {
2020-07-10 15:11:19 142 2
原创 学习C#设计模式(七)外观模式
外观模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Facade{ //苹果类 class Apple { public void PlantApple() { Console.WriteLine("种植苹果树");
2020-07-10 14:46:01 118 2
原创 学习C#设计模式(六)单例模式
单例模式代码实例为单例模式。该代码以果园喷洒杀虫剂为例实现单例模式的用法。目前在北京和上海两地都有果园,而只有一架直升机往返于两地,为两地的果园喷洒杀虫剂。该代码利用了单例模式使直升机实例全局唯一。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Singleton{ class Helico
2020-07-10 14:28:40 82
原创 学习C#设计模式(五)原型模式
原型模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Prototype{ public interface IOrchard { //复制果园接口方法 IOrchard Clone(); } //果园类继承果园接口 publ
2020-07-10 14:01:26 109
原创 学习C#设计模式(四)建造者模式
建造者模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Builder{ //果园类 public class Orchard { //果园名称 string name; //苹果 public string A
2020-07-10 10:12:17 87
原创 学习C#设计模式(三)抽象工厂模式
抽象工厂模式using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace AbstractFactory{ //抽象苹果类 public abstract class Apple { //抽象苹果种植方法 public abstract void PlantApple
2020-07-10 10:12:05 142
原创 学习C#设计模式(二)工厂模式
工厂模式废话不多说先上代码!using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace FactoryMethod{ //抽象水果类 public abstract class Fruit { //抽象种植水果类 public abstract void
2020-07-10 10:11:52 105
原创 学习C#设计模式(一)简单工厂模式
简单工厂模式今天开始学习C# 设计模式 将每天的学习成果分享到博客 希望可以帮助到大家!using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 简单工厂模式{ //抽象水果类 public abstract class Fruit { public abstract void
2020-07-10 10:11:39 174
原创 Unity中对游戏对象的操作
using UnityEngine;public class shiyan : MonoBehaviour{ public GameObject prefab;//要操作的对象 private void Start() { //给对象添加组件 prefab.AddComponent<Rigidbody>();//这里尖括号<>中可以填 组件 或者是脚本名称 //移除对象身上的组件 Destr
2020-07-09 10:44:03 542
原创 Unity使用代码的方式创建物体
using UnityEngine;public class AddGameObject : MonoBehaviour{ public GameObject prefab;//被克隆的对象 private void Start() { //第一种创建物体的方式 new GameObject(); GameObject go= new GameObject("Cube");//第一个参数是创建物体的名字(可填可不填) //第二种创建物体的方式(克隆)
2020-07-09 10:22:42 6003
原创 Unity AIP学习笔记(二)—Time静态类
Time静态类Time.time:表示从游戏开发到现在的时间,会随着游戏的暂停而停止计算。Time.unscaledTime 不考虑timescale时候与time相同,若timescale被设置,则无效。Time.deltaTime:表示从上一帧到当前帧的时间,以秒为单位。Time.unscaledDeltaTime 不考虑timescale时候与deltaTime相同,若timescale被设置,则无效。Time.timeSinceLevelLoad:表示从当前Scene开始到目前为止的时间,
2020-07-09 10:02:03 194
原创 Unity 常用API学习笔记(一)
这篇文章是我在学习Unity API的学习方法分享给大家Reset:Reset是在用户点击检视面板的Reset按钮或者首次添加该组件时被调用.此函数只在编辑模式下被调用.Reset最常用于在检视面板中给定一个最常用的默认值.Awake:Awake在脚本被实例化的时候就会被调用(不管脚本是不是enable的),而且在脚本的生命周期中只会被调用一次。Awake是在所有对象实例化之后,所以我们可以放心大胆地去使用诸如GmeObject.Fine之类的方法来在Awake中给各个组件之间添加引用 关系。Awake
2020-07-09 09:32:13 256
Fantazia Character Editor.unitypackage
2021-03-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人