/// <summary>
        /// Awake this instance.
        /// </summary>
        void Start()
        {
            if (Loom.Current == null)
            {
                Loom.Initialize();
            }

            vti_textOptions.layout.SizeChanged              += OnSizeChanged;
            vti_textOptions.layout.MajorChanged             += OnMajorLayoutChanged;
            vti_textOptions.parameter.BevelChanged          += OnBevelChanged;
            vti_textOptions.parameter.DepthChanged          += OnDepthChanged;
            vti_textOptions.parameter.UseLightProbesChanged += OnUseLightProbesChanged;
            vti_textOptions.parameter.FontNameChanged       += OnFontNameChanged;

            foreach (VTextInterface vi in vti_time)
            {
                vi.parameter.UseLightProbes = true;
            }
            vti_textOptions.parameter.UseLightProbes = true;
            vti_textured.parameter.UseLightProbes    = true;

            // init alignment
            old_headingValue = (int)VTextLayout.align.Center;
            SetAlignment(VTextLayout.align.Center);

            SetSize(0.4f);                                          // init size
            SetDepth(0.1f);                                         // init depth
            SetBevel(0.6f);                                         // init bevel

            SetFont(vti_textOptions.parameter.Fontname);            // init font type
            if (FontNameChanged != null)
            {
                FontNameChanged.Invoke(this, new GenericEventArgs <string>(vti_textOptions.parameter.Fontname));
            }
        }
    private void OnGUI()
    {
        GUIStyle style = new GUIStyle(GUI.skin.button);

        style.fontSize = 40;

        if (GUI.Button(new Rect(60, 150, 180, 100), "登录", style))
        {
            UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(1);
        }

        if (GUI.Button(new Rect(60, 300, 180, 100), "动态", style))
        {
            UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(2);
        }

        if (GUI.Button(new Rect(60, 450, 180, 100), "TapDB", style))
        {
            Loom.Initialize();
            TDSLogin.GetCurrentProfile((profile) => {
                if (profile == null)
                {
                    UnityNativeToastsHelper.ShowShortText("当前未登录");
                }
                else
                {
                    Loom.QueueOnMainThread((param) => {
                        UnityEngine.SceneManagement.SceneManager.LoadScene(3);
                    }, null);
                }
            });
        }
    }
Beispiel #3
0
 /// <summary>
 /// 创建并发队列
 /// </summary>
 /// <param name="concurrentCount">设置允许并发数,默认为1,即串行队列</param>
 public TaskQueue(int concurrentCount = 1)
 {
     if (concurrentCount < 0)
     {
         concurrentCount = 1;
     }
     _scheduler = new LimitedConcurrencyLevelTaskScheduler(concurrentCount);
     Loom.Initialize();
 }
Beispiel #4
0
 void Awake()
 {
     Loom.Initialize();
     InitCallbackForNet();
     if (!FB.IsInitialized)
     {
         Init();
     }
 }
Beispiel #5
0
    private void Awake()
    {
        Loom.Initialize();

        JMCameraManager.Instance.Initialize(() =>
        {
            _initDone = true;
        });
    }
Beispiel #6
0
 void Start()
 {
     UIUtils.Log(Application.persistentDataPath);
     //SetNode.ExpireSet();
     Loom.Initialize();
     OpenPage <LoginPage>();
     //OpenPage<MainPage>();
     //LoadingNode.OpenLoadingNode(LoadingType.Common);
 }
Beispiel #7
0
 private void Awake()
 {
     ClearConsole();
     Debug.Log("Launcher 启动");
     DontDestroyOnLoad(gameObject);
     _instance = this;
     Init();
     InitFsm();
     Loom.Initialize();//初始化消息监听
 }
    void Awake()
    {
        delteTempDir();

        Global.GetInstance().Init();

        Loom.Initialize();

        StageManager.SetStage_Idle();
    }
Beispiel #9
0
 public static void RunAsync(Action a)
 {
     Loom.Initialize();
     while (Loom.numThreads >= Loom.maxThreads)
     {
         Thread.Sleep(1);
     }
     Interlocked.Increment(ref Loom.numThreads);
     ThreadPool.QueueUserWorkItem(new WaitCallback(Loom.RunAction), a);
 }
Beispiel #10
0
 private void Start()
 {
     if (Debug.isDebugBuild)
     {
         Singleton <Fps> .Instance.Init();
     }
     Loom.Initialize();
     this.progress.fillAmount = 0f;
     base.gameObject.AddComponent <Main>();
 }
Beispiel #11
0
 public Thread RunAsync(Action a)
 {
     Loom.Initialize();
     while (Loom.numThreads >= this.maxThreads)
     {
         Thread.Sleep(1);
     }
     Interlocked.Increment(ref Loom.numThreads);
     ThreadPool.QueueUserWorkItem(new WaitCallback(this.RunAction), a);
     return(null);
 }
Beispiel #12
0
 protected override void Awake()
 {
     base.Awake();
     Loom.Initialize();
     FFMpegPath  = Application.streamingAssetsPath + "/FFmpeg/bin/ffmpeg.exe";
     DesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     if (!File.Exists(FFMpegPath))
     {
         DialogMgr.Instance.ShowDialogTypeBtnOne($"{FFMpegPath}\n文件夹不存在ffmpeg,请检查", "错误");
     }
 }
Beispiel #13
0
        private void Start()
        {
            Loom.Initialize();

            WebCamera.Initialize();

            VoiceReceiver.Initialize();

            GenerateModules();

            AppEntry();
        }
Beispiel #14
0
        private void Start()
        {
            // Threads
            Loom.Initialize();

            GetSettings();

            PrepareUI();

            CreatePlayersAndGrids();

            StartGrids();
        }
Beispiel #15
0
    // Start is called before the first frame update
    void Start()
    {
        ReceiveManage.GetInstance().AddListeners(this);

        UserInstance = new UserInfo();

        loginBut.onClick.AddListener(LoginBut);
        enrollBut.onClick.AddListener(EnrollBut);

        //实例化
        Loom.Initialize();

        enrollPanel.SetActive(false);
    }
    private void Awake()
    {
        StartCoroutine(LoadSavesAndSerializers());

        Loom.Initialize();
        if (Reference == null)
        {
            Reference = ScriptableObject.CreateInstance <StoredReferences>();
        }
        if (Application.isEditor)
        {
            GetAllInactiveGameObjects();
        }
        if (Instance != null && Instance != this)
        {
            if (Application.isEditor)
            {
                DestroyImmediate(Instance.gameObject);
            }
            else
            {
                Destroy(Instance.gameObject);
            }
        }

        Instance = this;
        hasWoken = true;
        if (Application.isPlaying && !hasRun)
        {
            _cached = Reference;
            hasRun  = true;
        }
        else if (!Application.isPlaying)
        {
            hasRun = false;
            if (_cached != null && _cached.Count > 0)
            {
                Reference = _cached.Alive();
            }
        }
        if (_initActions.Count > 0)
        {
            foreach (var a in _initActions)
            {
                a();
            }
            _initActions.Clear();
        }
    }
Beispiel #17
0
 void Awake()
 {
     savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TestDownLoad");
     Timer.IntializeDriver();
     Loom.Initialize();
     DownLoader = new HttpDownLoader();
     DownLoader.OnDownLoadCompleted.AddListener(() =>
     {
         this.finish.text = "下载完成!";
     });
     DownLoader.OnDownLoadUpdate.AddListener(v =>
     {
         this.update.text = string.Format("下载进度:{0} %", (v * 100).ToString("f2"));
     });
 }
Beispiel #18
0
 //使用LOOM
 private void Start()
 {
     txt        = GetComponent <Text>();
     actionList = new List <Action>();
     //必须在主线程初始化(创建脚本对象)
     Loom.Initialize();
     ThreadPool.QueueUserWorkItem((o) => {
         while (true)
         {
             Debug.Log(Thread.CurrentThread.Name + "---" + txt.text);
             Thread.Sleep(500);
             Loom.QueueOnMainThread(Fun1);
         }
     });
 }
Beispiel #19
0
        /// <summary>
        /// Init HMD device.
        /// </summary>
        public void Init()
        {
            if (m_IsInit)
            {
                return;
            }
            NRTools.Init();
            Loom.Initialize();

#if UNITY_ANDROID && !UNITY_EDITOR
            // Init before all actions.
            AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            m_UnityActivity = cls_UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            NativeApi.NRSDKInitSetAndroidActivity(m_UnityActivity.GetRawObject());
#endif
            m_IsInit = true;
        }
 void Awake()
 {
     Loom.Initialize();
     if (Reference == null)
     {
         Reference = ScriptableObject.CreateInstance <StoredReferences>();
     }
     if (Application.isEditor)
     {
         GetAllInactiveGameObjects();
     }
     if (Instance != null && Instance != this)
     {
         Destroy(Instance.gameObject);
     }
     Instance = this;
     hasWoken = true;
     if (Application.isPlaying && !hasRun)
     {
         _cached = Reference;
         hasRun  = true;
     }
     else if (!Application.isPlaying)
     {
         hasRun = false;
         if (_cached != null && _cached.Count > 0)
         {
             Reference = _cached.Alive();
         }
     }
     if (_initActions.Count > 0)
     {
         foreach (var a in _initActions)
         {
             a();
         }
         _initActions.Clear();
     }
     //giving errors, I don't think the previous people got saving working anyway.
     //I'll look into why if I have time.  If not, sorry to whoever has to.************
     //DontDestroyOnLoad (transform.gameObject);
 }
    public void Rebuild(bool rebuildMesh = false)
    {
        if (this == null || !this.gameObject.activeInHierarchy)
        {
            return;
        }

        if (Loom.Current == null)
        {
            Loom.Initialize();
        }

        if (null != m_fontInfo)
        {
            m_fontInfo.Shutdown();
            m_fontInfo = null;
        }
        UpdateGlyphs(rebuildMesh);
        UpdatePhysics();
        UpdateAdditionalComponents();
    }
    // Use this for initialization
    void Start()
    {
        Debug.Log("Start");
        dataQueue = new Queue <byte>();
        msgQueue  = new Queue <byte[]>();
        port      = new SerialPort(portName, baudrate, parite, dataBits, stopbits);
        //设定等待时间为4ms,若超过4ms则认为是下一帧数据
        port.ReadTimeout = 4;
        try
        {
            if (!port.IsOpen)
            {
                Debug.Log("串口打开成功!");
                port.Open();
            }
            else
            {
                Debug.Log("串口已经打开");
            }
            //前台线程和后台线程。这两者的区别就是:
            //应用程序必须运行完所有的前台线程才可以退出;
            //而对于后台线程,应用程序则可以不考虑其是否已经运行完毕而直接退出,所有的后台线程在应用程序退出时都会自动结束。
            portRev = new Thread(PortReceivedThread);
            portRev.IsBackground = true;
            portRev.Start();

            portDeal = new Thread(DealData);
            portDeal.IsBackground = true;

            portSend = new Thread(sendMessage);
            portSend.IsBackground = true;
            portSend.Start();
            Loom.Initialize();
            completed = true;
        }
        catch (System.Exception ex)
        {
            Debug.Log(ex.Message);
        }
    }
Beispiel #23
0
 private TcpClientService()
 {
     try
     {
         //创建服务器终结点 (需要改为真正服务器ip)
         IPEndPoint serverIpPoint = new IPEndPoint(IPAddress.Parse(Ip), Prot);
         //创建Tcp客户端
         client = new TcpClient();
         //连接服务器
         client.Connect(serverIpPoint);
         Debug.Log("建立连接");
         readByte = new byte[1024];
         //启动线程接收消息  (不需要接受可以不启动)
         Loom.Initialize();//在主线程初始化Loom对象
         this.client.GetStream().
         BeginRead(readByte, 0, readByte.Length, ReceiveMessage, null);
     }
     catch (Exception e)
     {
         Debug.Log("连接失败");
     }
 }
    public void CountDown(int totalNum, float delayTime, LuaFunction callback = null, LuaFunction endCallback = null)
    {
        Loom.Initialize();
        if (timer != null)
        {
            timer.Stop();
            timer = null;
        }
        timer           = new Timer(delayTime * 1000);
        timer.AutoReset = true;
        timer.Elapsed  += TimerUp;
        timer.Enabled   = true;

        this.currentIndex = totalNum;

        this.totalNum = totalNum;

        this.delayTime = delayTime;

        this.callback = callback;

        this.endCallback = endCallback;
    }
Beispiel #25
0
    // Use this for initialization
    void Start()
    {
        UnityEngine.Debug.Log("Start");

        Loom.Initialize();

        initWorkers(workers);

        foreach (Thread w in workers)
        {
            w.Start();
        }

        Vector3 ratio = ledseq.getRatio();

        objectsWorld   = new Bounds(objectWorldCenter, 2 * objectWorldExtend * ratio);
        particlesWorld = new Bounds(particlesWorldCenter, 2 * particlesWorldExtend * ratio);

        if (NeedSaveSeq)
        {
            ledseq.open(SeqName, SeqFrames);
        }

        if (NeedObjectVox)
        {
            initVoxObjects(objs);
            initMeshListeners(liss);
            vox = initMeshVox(ledseq, objectsWorld, objs);
            vox.Start();
            MeshVox.setGradientColor(NeedGradientColor, 1, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff);
            MeshVox.setSolidFill(NeedSolidFill);
            MeshVox.setFillColor(fillColor);
        }

        if (NeedParticleVox)
        {
            initParticleObjects(pos);
            initParticleListeners(pliss);
            pvox = initParticleVox(ledseq, particlesWorld, pos);
        }

        if (NeedClickRipple)
        {
            glow     = GameObject.Find("/Glow");
            glowps   = glow.GetComponent <ParticleSystem>();
            ripple   = GameObject.Find("/Ripple");
            rippleps = ripple.GetComponent <ParticleSystem>();
            if (ripple.GetComponent <IParticleObject>() != null)
            {
                pos.Add(ripple.GetComponent <IParticleObject>());
            }
        }

        if (NeedEmulator)
        {
            emulator = initEmulator(ledseq);
            ledWorld = emulator.getLedBound();
            GameObject marker = new GameObject("Marker");
            marker.transform.position = ledWorld.center;
        }

        if (NeedInteraction)
        {
            interaction = new LEDInteractionManager(emulator, this);
        }

        if (NeedBridge)
        {
            bridge = initBridge(ledseq);
        }
    }
Beispiel #26
0
 void Start()
 {
     UIUtils.Log(Application.persistentDataPath);
     Loom.Initialize();
     OpenPage <StartPage>();
 }
Beispiel #27
0
 void Start()
 {
     Loom.Initialize();
     Screen.orientation = ScreenOrientation.AutoRotation;
     AppFacade.Instance.StartUp();   //启动游戏
 }
Beispiel #28
0
 private void Start()
 {
     Loom.Initialize();
     RequestCaptureRcode();
 }
Beispiel #29
0
	private void Awake()
	{
		Loom.Initialize();
	}
Beispiel #30
0
    void Generate()
    {
        Loom.Initialize();

        new Thread(() => {
            while (true)
            {
                Loom.QueueOnMainThread(() => {
                    #region Asteroid Procedural Generation
                    if (procedural && createdOnCurrentLevel < toSpawn)
                    {
                        GameObject asteroid = TemplateAsteroid;

                        try {
                            Vector3 pos = new Vector3(random.Next(-6, 6),
                                                      random.Next((int)height + 7, (int)height + 20), 1);

                            bool rethrow      = false;
                            float minDistance = 10;

                            foreach (GameObject go in asteroidsThisLevel)
                            {
                                Vector3 vec3   = go.transform.position;
                                float distance = Vector3.Distance(vec3, pos);

                                if (distance < minDistance)
                                {
                                    minDistance = distance;
                                }
                            }


                            if (minDistance < minimumSpace)
                            {
                                rethrow = true;
                                Debug.Log("Rethrowinng! (Distance: " + minDistance + ")");
                            }

                            if (!rethrow)
                            {
                                asteroid.transform.position = pos;

                                asteroid = Instantiate(asteroid);

                                currentLevel = height;

                                createdOnCurrentLevel++;
                                asteroidsThisLevel.Add(asteroid);
                            }
                        } catch (Exception) { }
                    }
                    #endregion

                    if (currentLevel + 5 < height)
                    {
                        createdOnCurrentLevel = 0;

                        //Do some cleaning
                        foreach (GameObject go in asteroidsThisLevel)
                        {
                            Destroy(go, 10);
                        }

                        asteroidsThisLevel.Clear();
                    }
                });

                Thread.Sleep(10);
            }
        }).Start();
    }