Beispiel #1
0
    private void Init()
    {
        parentObj = GameObject.Find("Parent");
        camera    = GameObject.Find("Main Camera").transform;
        pillar    = GameObject.Find("Pillar").transform;

        ball      = GameObject.Find("Ball");
        ballScale = ball.transform.localScale.x;
        newScale  = ballScale.ToString();

        newSpeed    = PlayerPrefs.GetFloat(PrefConstans.RORATE_SPEED, PrefConstans.DEFAULT_SPEED).ToString();
        newWidth    = PlayerPrefs.GetFloat(PrefConstans.GAMEOBJECT_WIDTH, PrefConstans.DEFAULT_WIDTH).ToString();
        newGravity  = PlayerPrefs.GetFloat(PrefConstans.GRAVITY, PrefConstans.DEFAULT_GRAVITY).ToString();
        newUpSpeed  = PlayerPrefs.GetFloat(PrefConstans.UP_SPEED, PrefConstans.DEFAULT_UP_SPEED).ToString();
        newUpHeight = PlayerPrefs.GetFloat(PrefConstans.UP_DISTANCE, PrefConstans.DEFAULT_UP_DISTANCE).ToString();
        newGap      = PlayerPrefs.GetFloat(PrefConstans.GAMEOBJECT_GAP, PrefConstans.DEFAULT_GAP).ToString();
        newUpSingle = PlayerPrefs.GetFloat(PrefConstans.UP_SINGLE, PrefConstans.DEFAULT_UP_SINGLE).ToString();

        objSaver = new ObjSaver();
        objSaver.Init();
        objData = objSaver.Load();
        SetArrData();

        cubePrefab     = Resources.Load <GameObject>("Models/Cube");
        cylinderPrefab = Resources.Load <GameObject>("Models/Cylinder");

        objCreater = new CreateObj();

        objList = new List <GameObject>();
        InitSavedObj();
        //for (int i = 0; i < parentObj.transform.childCount; i++)
        //{
        //    objList.Add(parentObj.transform.GetChild(i).gameObject);
        //}
    }
Beispiel #2
0
 public GTObjectPool(CreateObj creator, UnityAction <T> actionOnGet, UnityAction <T> actionOnRelease)
 {
     this.m_objCreator      = creator;
     this.m_ActionOnGet     = actionOnGet;
     this.m_ActionOnRelease = actionOnRelease;
     GTObjectPool <T> .s_AllPool.Add(this);
 }
Beispiel #3
0
        public static int Main(String[] Args)
        {
            int iRep = 0;

            Console.Out.WriteLine("Test should return with ExitCode 100 ...");

            if (Args.Length == 1)
            {
                if (!Int32.TryParse(Args[0], out iRep))
                {
                    iRep = 10000;
                }
            }
            else
            {
                iRep = 10000;
            }
            Console.Out.WriteLine("iRep = " + iRep);

            CreateObj temp = new CreateObj(iRep);

            if (temp.RunTest())
            {
                Console.WriteLine("Test Passed");
                return(100);
            }

            Console.WriteLine("Test Failed");
            return(1);
        }
Beispiel #4
0
        public static int Main(String [] Args)
        {
            int iRep = 0;

            Console.Out.WriteLine("Test should return with ExitCode 100 ...");

            if( Args.Length == 1)
            {
                if (!Int32.TryParse( Args[0], out iRep ))
                {
                    iRep =10000;
                }
            }
            else
            {
                iRep =10000;
            }
            Console.Out.WriteLine("iRep = "+iRep );

            CreateObj temp = new CreateObj(iRep);

            if(temp.RunTest())
            {
                Console.WriteLine("Test Passed");
                return 100;
            }

            Console.WriteLine("Test Failed");
            return 1;

        }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     //--Get Component if not set--//
     if (!_rb2d)
     {
         _rb2d = GetComponent <Rigidbody2D>();
     }
     _createObj = GetComponent <CreateObj>();
 }
Beispiel #6
0
	public static int Main() {
		CreateObj temp = new CreateObj();
		temp.RunTest();

		if(temp.ExitCode==100)
			Console.WriteLine("Test for Finalize() for array of objects passed!");
		else 
			Console.WriteLine("Test for Finalize() for array of objects failed!");
                return temp.ExitCode;				
	}
Beispiel #7
0
	public static int Main() {

		CreateObj temp = new CreateObj();
		temp.RunTest();

        if (returnValue == 100) 
			Console.WriteLine("Test passed!");		
		else
			Console.WriteLine("Test failed!");

        return returnValue;
	}
Beispiel #8
0
 public static int Main( String [] str )
 {
     Console.WriteLine("Test should return with ExitCode 100 ...");
     CreateObj temp = new CreateObj();
     if (temp.RunTest())
     {
         Console.WriteLine("Test Passed");
         return 100;
     }
     Console.WriteLine("Test Failed");
     return 1;
 }
Beispiel #9
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test Passed");
            return(100);
        }
        Console.WriteLine("Test Failed");
        return(1);
    }
Beispiel #10
0
        public static int Main(String [] str)
        {
            Console.WriteLine("Test should return with ExitCode 100 ...");
            CreateObj temp = new CreateObj();

            if (temp.RunTest())
            {
                Console.WriteLine("Test Passed");
                return(100);
            }
            Console.WriteLine("Test Failed");
            return(1);
        }
 public static int Main() {
     CreateObj temp = new CreateObj();
     bool passed = temp.RunTest();
 
     if(passed) {
         Console.WriteLine("Test for ReRegisterForFinalize() passed!");
         return 100;
     }
     else {
         Console.WriteLine("Test for ReRegisterForFinalize() failed!");
         return 1;    
     }
 }
Beispiel #12
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test passed!");
            return 100;
        }

        Console.WriteLine("Test failed!");
        return 1;
    }
Beispiel #13
0
 public static int Main()
 {
     CreateObj temp = new CreateObj();
     if (temp.RunTest())
     {
         Console.WriteLine("Test for Copy of GCHandle passed!");
         return 100;
     }
     else
     {
         Console.WriteLine("Test for Copy of GCHandle failed!");
         return 1;
     }
 }
Beispiel #14
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        using (StreamWriter writer = File.CreateText("temp.txt"))
        {
            writer.WriteLine(@"***************** START ************************
This is a test file for testing IO in Finalizers.
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23
******************* END *****************************");
        }

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();  // makes sure Finalize() is called.
        GC.Collect();


        if (Dummy.visited)
        {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() passed!");
            return(100);
        }

        Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() failed!");
        return(1);
    }
Beispiel #15
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test for Finalize() for array of objects passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for Finalize() for array of objects failed!");
            return(1);
        }
    }
Beispiel #16
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test for Exception handling in Finalize() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for Exception handling in Finalize() failed!");
            return(1);
        }
    }
Beispiel #17
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test for Copy of GCHandle passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for Copy of GCHandle failed!");
            return(1);
        }
    }
    private void AddCreateObj2DToDict()
    {
        int temp = 0;

        for (int k = 0; k < StageInfoDictionary.Count; k++)
        {
            if (temp < CreateObjType2DDictionary[k].Count)
            {
                temp = CreateObjType2DDictionary[k].Count;
            }
        }
        //CreateObj2DDictionary = new Dictionary<int, CreateObj>[StageInfoDictionary.Count, CreateObjType2DDictionary.Length];
        CreateObj2DDictionary = new Dictionary <int, CreateObj> [StageInfoDictionary.Count, temp];
        for (int k = 0; k < StageInfoDictionary.Count; k++)
        {
            for (int j = 0; j < CreateObjType2DDictionary[k].Count; j++)
            {
                if (CreateObjType2DDictionary[k][j].CreateObjList != null)
                {
                    CreateObj2DDictionary[k, j] = new Dictionary <int, CreateObj>();
                    CreateObj2DDictionary[k, j].Clear();
                }
            }
        }

        for (int k = 0; k < StageInfoDictionary.Count; k++)
        {
            for (int j = 0; j < CreateObjType2DDictionary[k].Count; j++)
            {
                if (CreateObjType2DDictionary[k][j].CreateObjList == null)
                {
                    Debug.Log("XML파일 StageInfo " + k + "번째 ObjectList의 " + j + "번째의 ObjectType2D의 CreateObjectList가 없음");
                    continue;
                }

                for (int p = 0; p < CreateObjType2DDictionary[k][j].CreateObjList.Length; p++)
                {
                    int       key             = CreateObjType2DDictionary[k][j].CreateObjList[p].ID;
                    CreateObj CreateObj2DInfo = CreateObjType2DDictionary[k][j].CreateObjList[p];

                    if (!CreateObj2DDictionary[k, j].ContainsKey(key))
                    {
                        CreateObj2DDictionary[k, j].Add(key, CreateObj2DInfo);
                    }
                }
            }
        }
    }
Beispiel #19
0
    public static int Main()
    {
        CreateObj temp   = new CreateObj();
        bool      passed = temp.RunTest();

        if (passed)
        {
            Console.WriteLine("Test for WeakReference.Finalize() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for WeakReference.Finalize() failed!");
            return(1);
        }
    }
Beispiel #20
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();
        temp.RunTest();

        if (visited)
        {
            Console.WriteLine("Test for KeepAlive() passed!");
            return 100;
        }
        else
        {
            Console.WriteLine("Test for KeepAlive() failed!");
            return 1;
        }
    }
Beispiel #21
0
	public static int Main() {

		CreateObj temp = new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test for Finalize() for array of objects passed!");
            return 100;
        }
        else
        {
            Console.WriteLine("Test for Finalize() for array of objects failed!");
            return 1;
        }

	}
Beispiel #22
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        if (returnValue == 100)
        {
            Console.WriteLine("Test passed!");
        }
        else
        {
            Console.WriteLine("Test failed!");
        }

        return(returnValue);
    }
Beispiel #23
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        if (visited)
        {
            Console.WriteLine("Test for KeepAlive() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for KeepAlive() failed!");
            return(1);
        }
    }
Beispiel #24
0
	public static int Main() {

		CreateObj temp= new CreateObj();

        if (temp.RunTest())
        {
            Console.WriteLine("Test for Exception handling in Finalize() passed!");
            return 100;
        }
        else
        {
            Console.WriteLine("Test for Exception handling in Finalize() failed!");
            return 1;
        }
		
		
	}
Beispiel #25
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();
        temp.RunTest();


        if (visited)
        {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() passed!");
            return 100;
        }
        else
        {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() failed!");
            return 0;
        }
    }
Beispiel #26
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();  // makes sure Finalize() is called.
        GC.Collect();

        if (Dummy.visited)
        {
            Console.WriteLine("Test Passed");
            return(100);
        }
        Console.WriteLine("Test Failed");
        return(1);
    }
Beispiel #27
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();


        if (visited)
        {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() failed!");
            return(0);
        }
    }
Beispiel #28
0
    public static int Main() {
        CreateObj temp = new CreateObj();

        using (StreamWriter writer = File.CreateText("temp.txt"))
        {
writer.WriteLine(@"***************** START ************************
This is a test file for testing IO in Finalizers.
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23
******************* END *****************************");
        }


        if (temp.RunTest()) {
            Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() passed!");
            return 100;
        }

        Console.WriteLine("Test for Finalize() & WaitForPendingFinalizers() failed!");
        return 1;

    }
Beispiel #29
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();

        if (Dummy.count == 10)
        {
            Console.WriteLine("Test for Finalize() for array of objects passed!");
        }
        else
        {
            Console.WriteLine("Test for Finalize() for array of objects failed!");
        }
        return(temp.ExitCode);
    }
Beispiel #30
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();

        if (Dummy.flag == 99)
        {
            Console.WriteLine("Test for GCHandleType.Weak passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for GCHandleType.Weak failed!");
            return(1);
        }
    }
Beispiel #31
0
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();

        if (Dummy.visited)
        {
            Console.WriteLine("Test for WeakReference.Finalize() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for WeakReference.Finalize() failed!");
            return(1);
        }
    }
    public static int Main()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();

        GC.Collect();
        GC.WaitForPendingFinalizers();  // makes sure Finalize() is called.
        GC.Collect();

        if (Dummy.visited)
        {
            Console.WriteLine("Test for Exception handling in Finalize() passed!");
            return(100);
        }
        else
        {
            Console.WriteLine("Test for Exception handling in Finalize() failed!");
            return(1);
        }
    }
Beispiel #33
0
 internal static object FastCreateInstance(Type objtype)
 {
     try {
         CreateObj c = null;
         if (_constrcache.TryGetValue(objtype, out c))
         {
             return(c());
         }
         else
         {
             if (objtype.IsClass)
             {
                 DynamicMethod dynMethod = new DynamicMethod("_", objtype, null);
                 ILGenerator   ilGen     = dynMethod.GetILGenerator();
                 ilGen.Emit(OpCodes.Newobj, objtype.GetConstructor(Type.EmptyTypes));
                 ilGen.Emit(OpCodes.Ret);
                 c = (CreateObj)dynMethod.CreateDelegate(typeof(CreateObj));
                 _constrcache.Add(objtype, c);
             }
             else                     // structs
             {
                 DynamicMethod dynMethod = new DynamicMethod("_", typeof(object), null);
                 ILGenerator   ilGen     = dynMethod.GetILGenerator();
                 var           lv        = ilGen.DeclareLocal(objtype);
                 ilGen.Emit(OpCodes.Ldloca_S, lv);
                 ilGen.Emit(OpCodes.Initobj, objtype);
                 ilGen.Emit(OpCodes.Ldloc_0);
                 ilGen.Emit(OpCodes.Box, objtype);
                 ilGen.Emit(OpCodes.Ret);
                 c = (CreateObj)dynMethod.CreateDelegate(typeof(CreateObj));
                 _constrcache.Add(objtype, c);
             }
             return(c());
         }
     }
     catch (Exception exc) {
         throw new Exception(string.Format("Failed to fast create instance for type '{0}' from assembly '{1}'",
                                           objtype.FullName, objtype.AssemblyQualifiedName), exc);
     }
 }
 void Start()
 {
     CreatePenagon();
     CreateObj.CreateObjByMesh("五边形", _mesh);
 }
 // Use this for initialization
 void Start()
 {
     CreateMesh();
     CreateObj.CreateObjByMesh("正方形", _mesh);
 }
 void Start()
 {
     CreateObj.CreateObjByMesh("四面体", CreateTetrahedronMesh());
 }
 void Start()
 {
     CreateObj.CreateObjByMesh("四面体有贴图", UvMappingMesh());
 }
Beispiel #38
0
 // Use this for initialization
 void Start()
 {
     CreateObj.CreateObjByMesh("立方体", CreateCubeMesh());
 }
Beispiel #39
0
    public static void AllocAndDealloc()
    {
        CreateObj temp = new CreateObj();

        temp.RunTest();
    }