❤️Advanced UNITY actual combat-the most simple and unpretentious preface-1

  • foreword

        Last year and this year were ill-fated two years. From the end of last year to the middle of this year, I started my business with two small partners. I was working as a laborer while starting a business. My life was really fulfilling, and I didn’t have time for it. You go to other things, and after losing a lot of money, time and energy, you only add a little experience and moderate experience. When you come into contact with the difference between being a boss and being a manager, you also see all kinds of differences. The face of a person of character, of course, there are many friends who have helped me, I am really grateful to them.
        When I didn't have any preparations to do this, I still insisted on doing it. This impulse didn't happen in a short while. It was when I deeply didn't know what to do after I reached 30+. One way, ridiculously scratched and bruised by reality.
        In March of this year, I learned that my wife was pregnant. I was very excited when I heard the news for the first time, and then faced the choice of continuing to spend money on starting a business or choosing a family. In this regard, my two children and I My partners also had disagreements, but I still convinced them, and then I felt the heavy pressure on my shoulders even more, and I also hope that my baby can land on the ground in a healthy manner.

        This tutorial can also be regarded as a thank-you gift for me when I am approaching middle age! I also hope that those who are in the same industry can avoid detours.

       Extra! Extra! The lowest price in history! The lowest price ever! !
      I sell all kinds of lidar, including but not limited to <Silan A2/A3/S series> <YDLidar-G4> <Star second TOF> <Beiyang UST-10LX>, please note the model you need, I will see it directly Quoted
. Also undertake all kinds of radar interactive game outsourcing projects . You can directly add WeChat to communicate with me.


  • brief introduction

     In this actual combat advancement, a fake NetEase cloud music will be produced, including:
        (1) Basic introduction and use of each framework
        (2) Use Game Framework packaging tool to generate resources
        (3) Use ILRuntime to update code
        (4) ) Introduction to several commonly used design patterns
        (5) Use of TexturePacker atlas
        (6) Infinite scrolling component
        (7) <Unknown>
     You need to manually create project projects and integrate various frameworks by yourself, and the details will not be presented too much , you need to understand and write by yourself, and the party who reaches out will ignore it

This is the genuine version of Wangyiyun

     Unity version: 2020.1.0f1

     Visual Studio version: Community 2019

     The framework is divided into three steps, combining three common frameworks currently on the Internet:

  1. Game Framework The
    Game Framework is a game framework based on the Unity engine. It mainly encapsulates commonly used modules in the game development process, standardizes the development process to a large extent, speeds up development speed and guarantees product quality.
    The framework is divided into two layers, the underlying GameFramework logic, and the upper layer UnityGameFramework combined with mono logic .
    Framework address   https://github.com/EllanJiang/GameFramework/
  2. ILRuntime
    The ILRuntime project provides a platform based on C# 纯C#实现, 快速and the IL runtime, so that the code can be hot updated in the hardware environment (such as iOS) that does not support JIT 方便. Framework address   GitHub - Ourpalm/ILRuntime: Pure C# IL Interpreter Runtime, which is fast and reliable for scripting requirement on enviorments, where jitting isn't possible.可靠
  3. ETServer
    ET is an open source game client (based on unity3d) server-side dual-end framework. The server is a distributed game server developed using C#.net core. It is characterized by high development efficiency, strong performance, and double-end shared logic code. , The hot update mechanism of the client and server is complete, and at the same time it supports reliable udp tcp websocket protocol, supports 3D recast pathfinding on the server, and so on.
    Framework address   https://github.com/egametang/ET

     First of all, everyone needs to be able to use the Game Framework first. This part has been written in detail in a blog, and you can understand it by following the gourd. Design pattern thinking is also required .

        Plugins:

AVProVideo Local/Internet video playback Download address    extraction code: cdz4
uAudio Mp3 PlayerStreamer Local/Network Audio Playback Download address    extraction code: ey3d
DOTween animation plugin   download link
Spine skeletal animation  download link
TexturePacker Importer atlas download link

  • code style

This is just a personal habit and does not represent everyone's point of view.

(1) Code naming format

Class member variable naming m_MyVariable
Static variable naming s_MyVariable
function naming

Name according to function, for example:

Get variable type: GetVariableType()

Set variable type: SetVariableType()
Change type callback: OnChangedVariableTypeCallBack()

(2) About the Inspector view display in Unity

//使用此特性可以将 私有的/受保护的 显示在面板上, 同时通过类去调用的时候不会显示此变量
[SerializeField]
private Text m_AppName = null;

//对于需要通过类去调用私有变量的时候, 封装一个属性变量去传递
public Text AppName
{
    get { return m_AppName; }
}

//外部既可以调用也可以设置
public Text AppNameExample1
{
    get { return m_AppName; }
    set { m_AppName = value; }
}

//外部仅能调用, 仅类的内部设置值
public Text AppNameExample2
{
    get;
    private set;
}

Don't you think that the code looks very refreshing? Although the amount of code has increased, looking at the code is pleasing to yourself and others.

(3) Notes

If the function name is good enough, there is no need to comment, for example:

private void SearchMusic()
{
}

private void DownloadMusic(int id, string songName, string singer)
{
}

private void PlayMusic(int id, int duration)
{
}

Do you think such code needs to be commented?

public static Texture2D BeautySkinWhiteningDermabrasion(this Texture2D texture2D)
{
}

If this is the case, I suggest that it is better to make a comment. Of course, if you want to think carefully, you don’t need to make a comment, but this kind of behavior is not advocated, and I hope you will do it and cherish it.

(4) Set a global static data class GlobalData.cs

(5) Use using flexibly, for example: UnityEngine.Object and System.Object conflict, you can use
        using SysObject = System.Object; to deal with.

(6) There are also all kinds of codes that make people feel angry, please don't imitate them.

try
{
    //TODO:
}
catch(Exception e)
{
    Application.OpenURL("http://stackoverflow.com/search?q="+e.message,"_blank");
}
pause_state = pause_state == false ? true : false;
[SerializeField]
private InputField m_SearchMusicInput = null;

m_SearchMusicInput.onValueChanged.AddListener(OnSearchMusicValueChanged);

private void OnSearchMusicValueChanged(string content)
{
    m_SearchMusicInput.text = content;
}

Think of something more fun to add....


Next, the production chapter will start!
Since the blog is written while producing, the progress will be slow!
There is usually no time to write on weekends!
Interested friends can pay attention to a wave

Guess you like

Origin blog.csdn.net/flj135792468/article/details/120166222