weixudong
2020-11-12 52fb8c663b1e74b2a36b79bc70a452ca73db6341
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Core.Utilities;
/*using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Policy;
using TowerDefense.Economy;*/
using UnityEngine;
 
/// <summary>
/// 这种派生出来的Singleton如果要起作用,必须要Add Compoment到场景内的某一个Entity上。
/// </summary>
public class SingleTonCls : Singleton<SingleTonCls>
{
    public string mySingleString = "fuckzzj";
 
 
    /// <summary>
    /// 用于测试 Unity3D 的Add Compoment功能
    /// </summary>
    public Vector3 vec3Test;
 
    /// <summary>
    /// TEST CODE 用于测试确认细节
    /// </summary>
    public ChildCls testChildCls;
 
    /// <summary>
    /// 这种是关于delegate相关的代码,是不会在Unity的Spector面板中显示出来的,测试一下效果。
    /// </summary>
    public FilterTest myTestFilter;
 
    public static int myIntValue { get; set;}
 
    // Start is called before the first frame update
    void Start()
    {
        
    }
 
    // Update is called once per frame
    void Update()
    {
        
    }
 
    public string getString()
    {
        if (this.testChildCls != null)
            return this.testChildCls.getString();
        if( this.myTestFilter != null)
        {
            if( this.myTestFilter())
            {
                return "hello,fuckying";
            }
            else
            {
                return "hello,fuckzz";
            }
        }
        else
            return this.mySingleString;
    }
 
    /// <summary>
    /// 测试一个delegate相关的Filter代码
    /// </summary>
    /// <returns></returns>
    public delegate bool FilterTest();
}