Exemplo n.º 1
0
    public void Hit(DiskControl diskCtrl)
    {
        if (user.game == 0)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                //Debug.Log(hit.GetType());
                //Debug.Log(hit.transform);
                hit.collider.gameObject.SetActive(false);
                //hit.collider.gameObject.transform.position = new Vector3(6 - Random.value * 12, 0, 0);
                //factory.freeDisk(hit.collider.gameObject);
                Debug.Log("Hit");
                hit.collider.gameObject.GetComponent <DiskControl>().hit = true;
                scoreRecorder.add();
            }
            else
            {
                Debug.Log("Miss");
                scoreRecorder.miss();
            }
        }
        //user.status = Check();
    }
        /// <summary>
        /// 执行测试
        /// </summary>
        public override void ExecuteTest()
        {
            ModDiskPermission diskPermission = new ModDiskPermission("测试数据")
            {
                VolumeLabel               = "HELLO_WORLD",
                EnableModelControl        = true,
                EnableSerialNumberControl = true,
            };

            bool result = DiskControl.CF_SetPermission(new System.IO.DriveInfo("G"), diskPermission, out string errMsg);

            if (result)
            {
                PrintLogLn(MsgType.Success, "权限设置成功");
            }
            else
            {
                PrintLogLn(MsgType.Error, "权限设置失败: " + errMsg);
            }

            result = DiskControl.CF_IsExistPermission(new System.IO.DriveInfo("G"));
            if (result)
            {
                PrintLogLn(MsgType.Success, "已设置权限控制");
            }
            else
            {
                PrintLogLn(MsgType.Warn, "未设置权限控制");
            }

            int count = 5;

            while (count-- > 0)
            {
                PrintLogLn(MsgType.Info, $"第{5 - count }/{5}次验证");
                result = DiskControl.CF_CheckPermission(diskPermission, out errMsg);
                if (result)
                {
                    PrintLogLn(MsgType.Success, "权限验证成功");
                }
                else
                {
                    PrintLogLn(MsgType.Error, "权限验证失败: " + errMsg);
                }
                PrintLogLn(MsgType.Info, "任意键继续");
                Console.ReadKey(true);
            }

            result = DiskControl.CF_ClearPermission(new System.IO.DriveInfo("G"), out errMsg);
            if (result)
            {
                PrintLogLn(MsgType.Success, "权限清除成功");
            }
            else
            {
                PrintLogLn(MsgType.Error, "权限清除失败: " + errMsg);
            }
        }
Exemplo n.º 3
0
    public GameObject getDisk(int round)
    {
        if (sceneControler.scoreRecorder.Score >= round * 10)
        {
            if (sceneControler.user.round < 3)
            {
                sceneControler.user.round++;
                sceneControler.user.num            = 0;
                sceneControler.scoreRecorder.Score = 0;
            }
            else
            {
                sceneControler.user.game = 2;
            }
        }
        else
        {
            if (sceneControler.user.num >= 10)
            {
                sceneControler.user.game = 1;
            }
        }
        GameObject   newDisk;
        RoundControl diskOfCurrentRound = new RoundControl(round);

        if (free.Count == 0) // if no free disk, then create a new disk
        {
            newDisk = GameObject.Instantiate(diskPrefab) as GameObject;
            newDisk.AddComponent <ClickGUI>();
            diskData = newDisk.AddComponent <DiskControl>();
        }
        else // else let the first free disk be the newDisk
        {
            newDisk = free[0];
            free.Remove(free[0]);
            newDisk.SetActive(true);
            Debug.Log("get from free");
        }
        diskData       = newDisk.GetComponent <DiskControl>();
        diskData.color = diskOfCurrentRound.color;
        //Debug.Log("free: " + free.Count);

        newDisk.transform.localScale = diskOfCurrentRound.scale * diskPrefab.transform.localScale;
        newDisk.GetComponent <Renderer>().material.color = diskData.color;

        used.Add(newDisk);
        return(newDisk);
    }
Exemplo n.º 4
0
 /// <summary>
 /// 清除磁盘权限
 /// </summary>
 /// <param name="driveInfo">磁盘信息</param>
 /// <param name="errMsg">[OUT]错误信息</param>
 /// <returns>清除结果</returns>
 public static bool CF_ClearPermission(this DriveInfo driveInfo, out string errMsg)
 {
     return(DiskControl.CF_ClearPermission(driveInfo, out errMsg));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 检查磁盘权限
 /// </summary>
 /// <param name="diskPermission">磁盘权限</param>
 /// <param name="errMsg">[OUT]错误信息</param>
 /// <returns>检查结果</returns>
 public static bool CF_CheckPermission(this ModDiskPermission diskPermission, out string errMsg)
 {
     return(DiskControl.CF_CheckPermission(diskPermission, out errMsg));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 设置磁盘权限
 /// </summary>
 /// <param name="driveInfo">磁盘信息</param>
 /// <param name="diskPermission">磁盘权限</param>
 /// <param name="errMsg">[OUT]错误信息</param>
 /// <returns>设置结果</returns>
 public static bool CF_SetPermission(this DriveInfo driveInfo, ModDiskPermission diskPermission, out string errMsg)
 {
     return(DiskControl.CF_SetPermission(driveInfo, diskPermission, out errMsg));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 检查是否设置磁盘权限
 /// </summary>
 /// <param name="driveInfo">磁盘信息</param>
 /// <returns>检查结果</returns>
 public static bool CF_IsExistPermission(this DriveInfo driveInfo)
 {
     return(DiskControl.CF_IsExistPermission(driveInfo));
 }