3Dgame_homework7

2023-10-27

智能巡逻兵

要求

游戏设计要求

  1. 创建一个地图和若干巡逻兵(使用动画);
  2. 每个巡逻兵走一个 3-5 个边的凸多边型,其位置数据是相对地址,即每次确定下个目标位置时以自己当前的位置为原点计算;
  3. 巡逻兵碰撞到障碍物时,会自动选下一个点为目标;
  4. 巡逻兵能在设定范围内感知到玩家,并自动追击玩家;
  5. 巡逻兵失去玩家目标后,继续巡逻;
  6. 计分:玩家每次甩掉一个巡逻兵计一分,与巡逻兵碰撞游戏结束。

程序设计要求

  1. 必须使用订阅/发布模式传递消息:
    subject:OnLostGoal
    Publisher: ?
    Subscriber: ?
  2. 使用工厂模式来生产巡逻兵。

提示

  • 生成 3-5个边的凸多边型:
    随机生成矩形,在矩形每个边上随机找点,可得到 3-4 的凸多边型;在矩形每个边上随机找点且在其中一条边上找2个不同的点,可得到 4-5 的凸多边型;
  • 可以参考以前博客,给出新玩法。

相关理论

模型

  • 物体对象的组合,Unity 映射为游戏对象树;
  • 每个物体包含一个网格(Mesh)与蒙皮设置;
  • 包含使用的纹理、材质以及一个或多个动画剪辑;
  • 模型由 3D 设计人员使用 3D Max 等创建;
  • 显示:Mesh 表面网格,MeshRender 网格渲染器。

动画剪辑

  • 物体或骨骼的位置等属性在关键帧的时间序列;
  • 通过插值算法计算每帧的物体的位置或属性;
  • 可能包括:在动作捕捉工作室中捕捉的人形动画,美术师在外部 3D 应用程序中从头开始创建的动画,来自第三方库的动画集,从导入的单个时间轴剪切的多个剪辑。

三维模型是用三维建模软件建造的立体模型,也是构成 Unity 3D 场景的基础元素。

  • Unity 3D 几乎支持所有主流格式的三维模型,如 FBX 文件和 OBJ 文件等;
  • 开发者可以将三维建模软件导出的模型文件添加到项目资源文件夹,其会显示在 Assets 面板中;
  • 主流的三维建模软件:Autodesk 3D Studio Max,Autodesk Maya,Cinema 4D。

Mecanim 动画系统

一个丰富而复杂的动画系统(Mecanim),具有以下功能:

  • 为 Unity 的所有元素(包括对象、角色和属性)提供简单工作流程和动画设置;
  • 支持导入的动画剪辑以及 Unity 内创建的动画;
  • 人形动画重定向 - 能够将动画从一个角色模型应用到另一角色模型;
  • 对齐动画剪辑的简化工作流程;
  • 方便预览动画剪辑以及它们之间的过渡和交互;
  • 提供可视化编程工具来管理动画之间的复杂交互;
  • 以不同逻辑对不同身体部位进行动画化;
  • 分层和遮罩功能。

Animator 组件用于将动画分配给场景中的游戏对象,需要引用 Animator Controller,后者定义要使用哪些动画剪辑,并控制何时以及如何在动画剪辑之间进行混合和过渡。有动画的模型,编辑器会自动添加该组件;用户也可以在模型根对象手动添加该组件。

动画控制器:Mecanim 使用状态机管理运动。

设计状态机控制器: 状态、变迁、参数、条件四个部分设计。

动画控制器基础编程:设计时,功能强大;运行时,甚至无法查询设计了哪些状态。

动画控制器事件:行为与事件API脚本

实现过程与代码

面向对象的编程 - 设计模式:对象的行为

行为型模式分为类行为模式(采用继承机制来在类间分派行为)和对象行为模式(采用组合或聚合在对象间分配行为),用于描述程序在运行时复杂的流程控制,即描述多个类或对象之间怎样相互协作共同完成单个对象都无法单独完成的任务,涉及算法与对象间职责的分配,其中对象行为模式比类行为模式具有更大的灵活性。

行为型模式是 GoF 设计模式中最为庞大的一类,包含模板方法模式、策略模式、命令模式、职责链模式、状态模式、观察者模式、中介者模式、迭代器模式、访问者模式、备忘录模式、解释器模式11种模式。

依赖倒置(DIP)降低了客户与实现模块之间的耦合:

  • 原始代码 Sender 依赖 Receiver,Receiver 不依赖 sender;
  • 添加 IXxxListener 接口后, Receiver 依赖 IXxxListener 和 Sender;Sender 依赖 IXxxListener。

MVC 架构工厂模式


订阅/发布模式

UML图:

  • 发布者(事件源)/Publisher:事件或消息的拥有者;
  • 主题(渠道)/Subject:消息发布媒体;
  • 接收器(地址)/Handle:处理消息的方法;
  • 订阅者(接收者)/Subscriber:对主题感兴趣的人。

这也被称为观察者模式

  • 发布者与订阅者没有直接的耦合;
  • 发布者与订阅者没有直接关联,可以多对多通讯;
  • 在MVC设计中,是实现模型与视图分离的重要手段(例如数据 DataSource 对象,就是 Subject,任何使用该数据源的显示控件,如Grid都会及时更新)。

设计模式与游戏的持续改进

  • 当一个游戏对象实现“击打”行为,可能的处理是:
    按规则计分;
    按规则计算对周边物体的伤害;
    显示各种效果;
    … …
  • 如果在事件写了以上代码:
    想修改游戏规则,将无法保证修改正确,因为很多行为都有类似的代码;
    添加一些新行为,不仅无法复用代码,而且产生逻辑冲突。
  • 如果使用设计模式:
    计分员对象感兴趣该事件,会计分;
    控制器感兴趣该事件,会按规则做响应;
    添加新需求,如生成奖励对象,则添加一个奖励管理者。

代码

SSDirector.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SSDirector : System.Object {
    //singleton instance
    private static SSDirector instance;
    public ISceneController currentScene;
    public bool running {
        get;
        set;
    }
    public static SSDirector getInstance () {
        if (instance == null) {
            instance = new SSDirector ();
        }
        return instance;
    }
}

ISceneController.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface ISceneController {
    void LoadResources ();
    void CreatePatrols ();
    void CreateMore ();
}

SceneController.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using com.myspace;
public class SceneController : MonoBehaviour, ISceneController, IUserAction, IScore, Handle {
    public GameObject player;
    private SSDirector director;
    private bool canOperation;
    private bool create;
    private int bearNum;
    private int ellephantNum;
    private Subject sub;
    private Animator ani;
    private Vector3 movement;   // The vector to store the direction of the player's movement.
    void Awake () {
        director = SSDirector.getInstance ();
        sub = player.GetComponent<Player> ();
        ani = player.GetComponent<Animator> ();
        director.currentScene = this;
        director.currentScene.LoadResources ();
        director.currentScene.CreatePatrols ();
        Handle sc = director.currentScene as Handle;
        sub.Attach (sc);
        GetComponent<ScoreManager> ().resetScore ();
        bearNum = 0;
        ellephantNum = 0;
        create = false;
    }
    void Update () {
        int score = GetComponent<ScoreManager> ().getScore ();
        if (score % 10 == 0) {
            director.currentScene.CreateMore ();
        } else {
            create = true;
        }
    }
    #region ISceneController
    public void LoadResources () {
        GameObject Environment = Instantiate<GameObject> (
            Resources.Load<GameObject> ("Prefabs/Environment"));
        Environment.name = "Environment";
    }
    public void CreatePatrols () {      //创建游戏开始时的巡逻兵
        PatrolFactory pf = PatrolFactory.getInstance ();
        for (int i = 1; i <= 12; i++) {
            GameObject patrol = pf.getPatrol ();
            patrol.name = "Patrol" + ++bearNum;
            Handle p = patrol.GetComponent<Patrol> ();
            sub.Attach (p);
            patrol.GetComponent<Patrol> ().register (GetComponent<ScoreManager> ().addScore);
        }
    }
    public void CreateMore () {     //每增加十分,创建新的巡逻兵
        if (create) {
            PatrolFactory pf = PatrolFactory.getInstance ();
            for (int i = 1; i <= 3; i++) {
                GameObject patrol = pf.getPatrol ();
                patrol.name = "Patrol" + ++ellephantNum;
                Handle p = patrol.GetComponent<Patrol> ();
                sub.Attach (p);
                patrol.GetComponent<Patrol> ().register (GetComponent<ScoreManager> ().addScore);
            }
            for (int i = 1; i <= 3; i++) {
                GameObject patrolplus = pf.getPatrolPlus ();
                patrolplus.name = "Patrolplus" + ++bearNum;
                Handle p = patrolplus.GetComponent<Patrol> ();
                sub.Attach (p);
                patrolplus.GetComponent<Patrol> ().register (GetComponent<ScoreManager> ().addScore);
            }
            create = false;
        }
    }
    #endregion
    #region IUserAction
    public void movePlayer (float h, float v) {
        if (canOperation) {
            player.GetComponent<Player> ().move (h, v);
            if (h == 0 && v == 0) {
                ani.SetTrigger ("stop");
            } else {
                ani.SetTrigger ("move");
            }
        }
    }
    public void setDirection (float h, float v) {
        if (canOperation) {
            player.GetComponent<Player> ().turn (h, v);
        }
    }
    public bool GameOver () {
        return (!canOperation);
    }
    #endregion
    #region ISceneController
    public int currentScore () {
        return GetComponent<ScoreManager> ().getScore ();
    }
    #endregion
    #region Handele
    public void Reaction (bool isLive, Vector3 pos) {
        ani.SetBool ("live", isLive);
        canOperation = isLive;
    }
    #endregion
}

IUserAction.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IUserAction {
    void movePlayer (float h, float v);
    void setDirection (float h, float v);
    bool GameOver ();
}

UI.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class UI : MonoBehaviour {
    private IUserAction action;
    private IScore score;
    public Transform player;            // The position that that camera will be following.
    public float smoothing = 5f;        // The speed with which the camera will be following.
    public Text s;
    public Text gg;
    public Button re;
    Vector3 offset;                     // The initial offset from the player.
    // Use this for initialization
    void Start () {
        action = SSDirector.getInstance ().currentScene as IUserAction;
        score = SSDirector.getInstance ().currentScene as IScore;
        // Calculate the initial offset.
        offset = transform.position - player.position;
        re.gameObject.SetActive (false);
        Button btn = re.GetComponent<Button> ();
        btn.onClick.AddListener(restart);
    }
    void Update () {
        // Create a postion the camera is aiming for based on the offset from the player.
        Vector3 playerCamPos = player.position + offset;
        // Smoothly interpolate between the camera's current position and it's player position.
        transform.position = Vector3.Lerp (transform.position, playerCamPos, smoothing * Time.deltaTime);
        float h = Input.GetAxisRaw("Horizontal");
        float v = Input.GetAxisRaw("Vertical");
        move (h, v);
        turn (h, v);
        showScore ();
        gameOver ();
    }
    //移动玩家
    public void move (float h, float v) {
        action.movePlayer (h, v);
    }
    //使玩家面向移动方向
    public void turn (float h, float v) {
        if (h != 0 || v != 0) {
            action.setDirection (h, v);
        }
    }
    //显示分数
    public void showScore () {
        s.text = "Score : " + score.currentScore ();
    }
    //游戏结束
    public void gameOver () {
        if (action.GameOver ()) {
            if (!re.isActiveAndEnabled) {
                re.gameObject.SetActive (true);
            }
            gg.text = "Game Over!";
        }
    }
    //重新开始
    public void restart () {
        SceneManager.LoadScene ("main");
    }
}

Subject.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class Subject : MonoBehaviour {
    protected List<Handle> listeners = new List<Handle> ();
    public abstract void Attach (Handle listener);
    public abstract void Detach (Handle listener);
    public abstract void Notify (bool live, Vector3 pos);
}

Handle.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface Handle {
    void Reaction (bool isLive, Vector3 pos);
}

Player.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : Subject {
    private bool isLive;
    private Vector3 position;
    private float speed;
    Vector3 movement;   // The vector to store the direction of the player's movement.
    protected List<Handle> handles = new List<Handle> ();   //所有观察者
    // Use this for initialization
    void Start () {
        isLive = true;
        speed = 8.0f;
    }
    public override void Attach (Handle h) {
        handles.Add (h);
    }
    public override void Detach (Handle h) {
        handles.Remove (h);
    }
    public override void Notify (bool live, Vector3 pos) {
        foreach (Handle h in handles) {
            h.Reaction(live, pos);
        }
    }
    //玩家碰到巡逻兵,就死亡
    void OnCollisionEnter (Collision other) {
        if (other.gameObject.tag == "patrol") {
            isLive = false;
        }
    }
    // Update is called once per frame
    void Update () {
        position = transform.position;
        Notify (isLive, position);
    }
    public void move (float h, float v) {
        if (isLive) {
            // Set the movement vector based on the axis input.
            movement.Set (h, 0f, v);
            // Normalise the movement vector and make it proportional to the speed per second.
            movement = movement.normalized * speed * Time.deltaTime;
            // Move the player to it's current position plus the movement.
            GetComponent<Rigidbody> ().MovePosition (transform.position + movement);
        }
    }
    public void turn (float h, float v) {
        if (isLive) {
            // Set the movement vector based on the axis input.
            movement.Set (h, 0f, v);
            Quaternion rot = Quaternion.LookRotation (movement);
            // Set the player's rotation to this new rotation.
            GetComponent<Rigidbody> ().rotation = rot;
        }
    }
}

Patrol.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Patrol : MonoBehaviour, Handle {
    protected Vector3 bothPos;
    private bool playerIsLive;
    private Vector3 playerPos;
    private Vector3[] posSet;
    private int currentSide;
    private int sideNum;
    private bool turn;
    private bool isCatching = false;
    public int score = 1;
    public float field = 7f;
    public float speed = 1f;
    public delegate void getScore (int n);
    public event getScore escape;
    public void register (getScore s) {
        escape += s;
    }
    public void unRegister (getScore s) {
        escape -= s;
    }
    // Use this for initialization
    void Start () {
        transform.position = getBothPos ();
        bothPos = transform.position;
    }
    void Awake () {
        turn = false;
        sideNum = Random.Range (3, 6);
        currentSide = 0;
        if (sideNum == 3) {
            posSet = new Vector3[] { new Vector3 (0, 0, 0), new Vector3 (8, 0, 0),
                new Vector3 (4, 0, 6), new Vector3 (0, 0, 0) };
        } else if (sideNum == 4) {
            posSet = new Vector3[] { new Vector3 (0, 0, 0), new Vector3 (8, 0, 0),
                new Vector3 (8, 0, 8), new Vector3 (0, 0, 8), new Vector3 (0, 0, 0) };
        } else {
            posSet = new Vector3[] { new Vector3 (0, 0, 0), new Vector3 (5, 0, 0),
                new Vector3 (7, 0, 5), new Vector3 (3, 0, 8), new Vector3 (-2, 0, 5), new Vector3 (0, 0, 0) };
        }
    }
    void OnCollisionEnter (Collision other) {
        turn = true;
    }
    public bool inField (Vector3 targetPos) {
        float distance = (transform.position - targetPos).sqrMagnitude;
        if (distance <= field * field) {
            return true;
        }
        return false;
    }
    public void Reaction (bool isLive, Vector3 pos) {
        playerIsLive = isLive;
        playerPos = pos;
    }
    public void catchPlayer () {
        bothPos = transform.position;
        isCatching = true;
        transform.LookAt (playerPos);
        transform.position = Vector3.Lerp (transform.position, playerPos, speed * Time.deltaTime);
    }
    public bool patrolInMap (int side) {
        if (isCatching && playerIsLive) {
            isCatching = false;
            if (escape != null) {
                escape (score);
            }
        }
        if (turn) {
            turn = false;
            Vector3 v = transform.forward;
            Quaternion dir = Quaternion.LookRotation (v);
            Quaternion toDir = Quaternion.LookRotation (-v);
            transform.rotation = Quaternion.RotateTowards (dir, toDir, 1f);
            return true;
        }
        if (transform.position != bothPos + posSet [side + 1]) {
            transform.LookAt (bothPos + posSet [side + 1]);
            transform.position = Vector3.Lerp (transform.position ,
                bothPos + posSet [side + 1], speed * Time.deltaTime);
        }
        if ((transform.position - (bothPos + posSet [side + 1])).sqrMagnitude <= 0.1f) {
            return true;
        }
        return false;
    }
    public Vector3 getBothPos () {
        while (true) {
            Vector3 pos = new Vector3 (Random.Range (-30f, 30f), 0, Random.Range (-30f, 30f));
            if ((pos - Vector3.zero).sqrMagnitude >= 100f) {
                return pos;
            }
        }
    }
    // Update is called once per frame
    void Update () {
        if (playerIsLive && inField (playerPos)) {
            catchPlayer ();
        } else {
            if (patrolInMap (currentSide)) {
                if (++currentSide >= sideNum) {
                    bothPos = transform.position;
                    currentSide = 0;
                }
            }
        }
    }
}

PatrolFactory.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace com.myspace{
    public class PatrolFactory : System.Object {
        private static PatrolFactory instance;
        public static PatrolFactory getInstance () {
            if (instance == null) {
                instance = new PatrolFactory ();
            }
            return instance;
        }
        public GameObject getPatrol () {
            GameObject patrol = GameObject.Instantiate<GameObject> (
                    Resources.Load<GameObject> ("Prefabs/Patrol"));;
            return patrol;
        }
        public GameObject getPatrolPlus () {
            GameObject patrolplus = GameObject.Instantiate<GameObject> (
                Resources.Load<GameObject> ("Prefabs/Patrolplus"));;
            return patrolplus;
        }
        public void freePatrol (GameObject p) {
            p.SetActive (false);
        }
    }
}

IScore.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IScore {
    int currentScore ();
}

ScoreManager.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreManager : MonoBehaviour, Handle {
    private int score;
    private bool playerIsLive;
    public void Reaction (bool isLive, Vector3 pos) {
        playerIsLive = isLive;
    }
    public int getScore () {
        return score;
    }
    public void addScore (int s) {
        if (playerIsLive) {
            score += s;
        }
    }
    public void resetScore () {
        score = 0;
    }
    void Awake () {
        playerIsLive = true;
        score = 0;
    }
    void Update () {}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

3Dgame_homework7 的相关文章

  • Yii Framework 开发教程(33) Zii组件-Accordion示例

    Zii组件中包含了一些基于JQuery的UI组件 这些UI组件定义在包zii widgets jui中 包括CJuiAccordion CJuiAutoComplete CJuiDatePicker等 本篇介绍CJuiAccordion 显
  • ARM的37个寄存器和异常处理机制详解

    1 ARM的37个寄存器 ARM的37个寄存器中 30个寄存器是 通用 1个固定用作PC 程序控制寄存器 一个固定用作CPSR 程序状态寄存器 5个固定用作5种异常模式下的SPSR 程序状态保存寄存器 特别注意user模式和sys模式共用寄
  • SPI总线的原理

    一 简介 SPI Serial Peripheral Interface 串行外围设备接口 是Motorola公司提出的一种同步串行接口技术 是一种高速 全双工 同步通信总线 在芯片中只占用四根管脚用来控制及数据传输 广泛用于EEPROM
  • Unity PackageManager一直加载不到信息的解决方法

    关闭unity 断开网络连接 打开unity 这时候会加载出来 连接网络开始install
  • 牛客网——两数之和

    题目描述 给出一个整数数组 请在数组中找出两个加起来等于目标值的数 你给出的函数twoSum 需要返回这两个数字的下标 index1 index2 需要满足 index1 小于index2 注意 下标是从1开始的 假设给出的数组中只存在唯一
  • 解决error: subprocess-exited-with-error

    运行 pip install upgrade setuptools 即可解决
  • Playwright解决永久保存下载文件

    Playwright默认在浏览器关闭的时候 所有的临时文件都将删除 无论你是自定义位置还是默认位置 那么如何正确下载对应的文件呢 废话不多说 大家直接看以下代码即可 这里还是告诫大家一下 多研究官网的API文档 别学我慌慌张张去搞了 啥都没
  • QTP的那些事--项目实践操作案例代码--查询操作

    1 一下的代码记录的是我对于一个查询操作的自动化的思路 遗憾的是预期的结果可能需要手动输入到datatable中 以后逐步完善 将所有的预期值都自动输入到excel中 登陆系统 2 3 RunAction login loginsystem
  • HDS 存储名词解释

    DKU 扩展柜 DKC 控制柜 DKA 后端端口 CHA 前端端口 CSW 交换卡 SVP 内置服务PC 另一个含义是服务程序 CM Cache Memory数据内存 SM Share Memory共享内存 HDU Hard Disk Un
  • npoi全国计算机编程,NPOI 导入Excel

    NPOI 导入Excel public static List GetExcelToList string excelfileName List list new List ISheet sheet null PropertyInfo pr
  • Nginx进程管理

    Nginx进程管理 1 Nginx进程管理之master进程 监控进程充当整个进程组与用户的交互接口 同时对进程进行监护 它不需要处理网络事件 不负责业务的执行 只会通过管理worker进程来实现重启服务 平滑升级 更换日志文件 配置文件实
  • 利用lda对文本进行分类_使用lda进行文本分类

    利用lda对文本进行分类 LDA or Latent Dirichlet Allocation is one of the most widely used topic modelling algorithms It is scalable
  • Linux——gcc/g++以及make/Makefile的使用

    简介 在Linux的系统中 想要完成代码编译 gcc g 是不可缺少的工具 而make Makefile能否熟练应用则从一个侧面体现出一个人是否有能力独自完成一个大型工程 而本篇文章就带领大家了解一些gcc g 和make Makefile
  • 层叠上下文(stacking context)

    一 什么是层叠式上下文 层叠上下文 是HTML中的一个三维概念 如果元素具备以下任何一个条件 则该元素会创建一个新的层叠上下文 根元素 z index不为auto的定位元素 二 什么是层叠级别 同一个层叠上下文的背景色以及内部元素 谁在上谁
  • IPsec SA 创建步骤——IKE协议

    IPsec SA 创建步骤概述 IPsec SA creation steps There are two steps on the IPsec SA creation phase 1 is to creat IKE SA and phas
  • 为什么重写equals方法时必须重写hashcode方法

    文章目录 1 与 equals的区别 2 重写equals 3 为什么重写equals方法时必须重写hashcode方法 3 1 Hash算法 3 2 HashCode 相关文章 为什么重写equals方法时必须重写hashcode方法 J
  • 在vue页面中,直接展示代码及样式高亮(vue 中使用 highlight)

    参考链接 https blog csdn net u011364720 article details 90417302 前言 效果如下 想要在前端页面中 直接展示代码的样式 就像一些开发文档的源码展示一样 使用插件 highlight j
  • C++智能指针 shared_ptr,unique_ptr和weak_ptr

    1 智能指针为什么存在 因为C 没有自动回收内存的机制 因此每一次new出来的动态内存必须手动delete回去 因此智能指针可以解决这个问题 2 智能指针的大致描述是什么 智能指针 自动负责释放所指向的对象 实际上它利用了栈的机制 每一个智
  • Go语言基础知识4——依赖管理

    依赖 别人写的库 依赖其进行编译 依赖管理的三个阶段 GOPATH GOVENDOR go mod GOPATH和GOVENDOR正在向go mod迁移 一 GOPATH GOPATH是一个环境 就是一个目录 默认在 go unix lin
  • spring-boot集成spring-brick实现动态插件

    spring boot集成spring brick实现动态插件 spring boot集成spring brick实现动态插件 项目结构 需求实现 spring boot集成spring brick 环境说明 1 主程序集成spring b

随机推荐

  • GnosisSafeProxyFactory合约学习

    GnosisSafe是以太坊区块链上最流行的多签钱包 它的最初版本叫 MultiSigWallet 现在新的钱包叫Gnosis Safe 意味着它不仅仅是钱包了 它自己的介绍为 以太坊上的最可信的数字资产管理平台 The most trus
  • UTXO的定义(交易,输入输出)-1

    在比特币系统中并没有账户的概念 有的是遍布全网区块链的UTXO 所谓UTXO是指关联比特币地址的比特币金额的集合 是一个包含数据和可执行代码的数据结构 一个UTXO的基本单位是 聪 聪 是比特币的最小计量单位 一个比特币等于10 8聪 一个
  • Go标准库日志打印,以及同时输出到控制台和文件

    打印 在使用go写一些小程序时 我们没必要引入额外的包 直接使用fmt标准包打印即可 import fmt func main fmt Println line1 fmt Print line2 fmt Printf line d n 3
  • PTA 剥洋葱(C语言 + 详细注释 + 代码超简单)

    输入格式 一行 一个整数 即图形的层数 输出格式 如上述图形 输入样例 3 输出样例 AAAAA ABBBA ABCBA ABBBA AAAAA 打印图形题关键是找规律 一般只需两重循环 行循环 列循环 include
  • keras_contrib 安装(各种尝试详细过程)

    问题描述 from keras contrib layers import CRF 指示报错没有安装此模块 但直接查找模块找不到 百度的解决方法 第一次尝试 pip install git https www github com kera
  • Git学习笔记(Ubuntu)Git分支

    分支简介 分支创建 git branch xx 查看 git log oneline decorate 分支切换 git checkout xx 查看分叉历史 git log oneline decorate graph all 分支新建与
  • npm -v 报错的解决方案

    如果你尝试了 百度里 所有查到的方法 都没有用 可以试着 在安装完成后 进入 C Users Administrator config configstore 文件夹 清理 update notifier npm json 文件后 再试 也
  • check_hostname requires server_hostname

    代理服务器 Proxy Server 的功能是代理网络用户去取得网络信息 形象地说 它是网络信息的中转站 是个人网络和Internet服务商之间的中间代理机构 负责转发合法的网络信息 对转发进行控制和登记 vpn
  • myslq服务安装启动

    D Program Files x86 MySQL MySQL Server 5 5 bin gt mysqld exe install Service successfully installed D Program Files x86
  • 【MATLAB】三维图像绘制+图形对象句柄

    目录 一 三维曲面绘图 二 图形对象句柄 1 三位图形属性设置 2 动态图 用循环语句 pause 叠加画图 hold on hold on 的基础上刷新画图 set h xdata x ydata y 每次重置点 曲线或曲面 的横纵坐标
  • Could not read Username Error for Git

    在用使用Vundle安装neocomplete时失败 查看log提示could not read Username for https github com Device not configured 经检查这里提示的Username是指n
  • vue3中,this.$router.push刷新当前页面,该页面不重新加载需要手动刷新的解决方案

    1 demo vue 在this router push demo 后 demo vue没有刷新也没有重新加载 但是路由地址已经变了 只是需要手动刷新 2 解决 监听一下当前路由 watch route to from to表示要跳转的路由
  • 固定资产可视化智能管理系统

    什么是资产管理 企业一般有设备 工具 IT通讯 仪器 载具 文档 家具和一些其他的资产 比如某个制造企业现状 共计约有8000个资产分布存在于30个区域 包括实验室 办公室和工厂 其中每年新入资产预估为2000个 报废资产预计1800个 在
  • Python 3D函数图形投影到2D坐标轴上

    1 contourf函数命令 cmap matplotlib cm jet norm matplotlib colors Normalize vmin min np array sol vmax max np array sol plt c
  • 统计学习方法 第七章习题答案

    习题7 1 题目 比较感知机的对偶形式与线性可分支持向量机的对偶形式 解答 感知机 原始形式 min w b
  • linux:linux基础命令(一)

    前言 为什么要学linux 为了运维 项目上线 所以要了解linux操作系统 什么是LNMP linux nginx mysql php小常识 一个用Linux Shell编写的可以为CentOS RadHat Debian Ubuntu
  • 进程和子进程

    进程和子进程 父子进程有独立的数据段 堆 栈 共享代码段 Linux中每个进程都有4G的虚拟地址空间 独立的3G用户空间和共享的1G内核空间 fork 创建的子进程也不例外 子进程资源的由来 1G内核空间既然是所有进程共享 因此fork 创
  • input type=“file”上传文件(一)

    使用input标签 type file 的时候就可以上传文件 为input标签添加change事件 调用函数
  • qt 添加动作 (QAction)

    Qt 5 mainwindow h ifndef MAINWINDOW H define MAINWINDOW H include
  • 3Dgame_homework7

    3D游戏 作业7 智能巡逻兵 要求 游戏设计要求 程序设计要求 提示 相关理论 实现过程与代码 智能巡逻兵 要求 游戏设计要求 创建一个地图和若干巡逻兵 使用动画 每个巡逻兵走一个 3 5 个边的凸多边型 其位置数据是相对地址 即每次确定下