Ejemplo n.º 1
0
 private void CaculateGroupInThread(object param)
 {
     CaculateParam param2 = (CaculateParam)param;
     ISimulationGroup group = param2.Group;
     ISimulationEngine engine = param2.Engine;
     this.m_ProgressMgr = new ProgressMgr(engine, group.Name, this.m_AppContext);
     CalculateState calculating = CalculateState.Calculating;
     try
     {
         try
         {
             ISimulationResult result;
             group.Result = null;
             this.m_GroupCollection.ChangeGroupState(group.ID, calculating);
             engine.Init(this.m_AppContext);
             this.m_ProgressMgr.Start();
             this.m_EventViewService.WriteLog(SimulationResource.SIMULATION_CAL_START, LogLevel.Info);
             if (engine.Run(group, out result))
             {
                 calculating = CalculateState.SuccessfulEnd;
                 group.Result = result;
             }
             else
             {
                 calculating = CalculateState.FailedEnd;
             }
             this.m_EventViewService.WriteLog(SimulationResource.SIMULATION_CAL_END, LogLevel.Info);
         }
         catch (Exception exception)
         {
             calculating = CalculateState.FailedEnd;
             this.m_EventViewService.WriteLog(SimulationResource.SIMULATION_CAL_ERROR, LogLevel.Error);
             WriteLog.Logger.Error(SimulationResource.SIMULATION_CAL_ERROR, exception);
         }
     }
     finally
     {
         lock (this.m_EngineDic)
         {
             this.m_EngineDic.Remove(group.ID);
             this.m_ProgressMgr.Stop();
             this.m_GroupCollection.ChangeGroupState(group.ID, calculating);
         }
     }
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        boundsMgr            = GetComponent <BoundsMgr>();
        udpMgr               = GetComponent <UdpMgr>();
        touchMouseMgr        = GetComponent <TouchMouseMgr>();
        assetMgr             = GetComponent <AssetMgr>();
        planeFinderMgr       = GetComponent <PlaneFinderMgr>();
        materialMgr          = GetComponent <MaterialMgr>();
        senderReceiverCamMgr = GetComponent <SenderReceiverCamMgr>();
        highlightMgr         = GetComponent <HighlightMgr>();
        smoothMgr            = GetComponent <SmoothMgr>();
        pointerMgr           = GetComponent <PointerMgr>();
        avoidMgr             = GetComponent <AvoidMgr>();
        hitPlaceMgr          = GetComponent <HitPlaceMgr>();
        ticTacToeMgr         = GetComponent <TicTacToeMgr>();
        connectMgr           = GetComponent <ConnectMgr>();
        screwMgr             = GetComponent <ScrewMgr>();
        chessMgr             = GetComponent <ChessMgr>();
        pongMgr              = GetComponent <PongMgr>();
        progressMgr          = GetComponent <ProgressMgr>();
        autoMgr              = GetComponent <AutoMgr>();
        sculptMgr            = GetComponent <SculptMgr>();
        noiseMgr             = GetComponent <NoiseMgr>();
        modeMgr              = GetComponent <ModeMgr>();
        assetBundlesMgr      = GetComponent <AssetBundlesMgr>();
        shakeMgr             = GetComponent <ShakeMgr>();
        //
        goAssetsHolder = GameObject.Find("AssetsHolder");

        goDownloadList       = GameObject.Find("DownloadList");
        goBundleDownloadList = GameObject.Find("BundleDownloadList");
        goList       = GameObject.Find("List");
        goBundleList = GameObject.Find("BundleList");
        textFps      = GameObject.Find("TextFps").GetComponent <Text>();
        imagePlane   = GameObject.Find("ImagePlane").GetComponent <Image>();

        textLog             = GameObject.Find("TextLog").GetComponent <Text>();
        goProgressIndicator = GameObject.Find("ProgressIndicator");
        goProgressLists     = new List <GameObject>();
        LoadProgressLists();
        goPointerOrig = GameObject.Find("PointerOrig");
        goPointer     = GameObject.Find("Pointer");
        camMain       = GameObject.Find("ARCamera").GetComponent <Camera>();
        goGround      = GameObject.Find("Ground");
        goGroundBase  = GameObject.Find("GroundBase");
        goBoundingBox = GameObject.Find("BoundingBox");
        goAdvances    = new List <GameObject>();
        goRetreats    = new List <GameObject>();
        goClouds      = new List <GameObject>();
        LoadAdvances();
        LoadRetreats();
        LoadClouds();
        goAdvanceLights = new List <GameObject>();
        goRetreatLights = new List <GameObject>();
        goCloudLights   = new List <GameObject>();
        LoadAdvanceLights();
        LoadRetreatLights();
        LoadCloudLights();
        buttonInfo = GameObject.Find("ButtonInfo").GetComponent <Button>();
        buttonLog  = GameObject.Find("ButtonLog").GetComponent <Button>();
        buttonInfo.onClick.AddListener(ButtonInfoClicked);
        buttonLog.onClick.AddListener(ButtonLogClicked);
        imageInfo         = GameObject.Find("ImageInfo").GetComponent <Image>();
        textPlace         = GameObject.Find("TextPlace").GetComponent <Text>();
        goReceiverCamOrig = GameObject.Find("ReceiverCamOrig");
        goReceiverCam     = GameObject.Find("ReceiverCam");
        goSenderCamOrig   = GameObject.Find("SenderCamOrig");
        goSenderCam       = GameObject.Find("SenderCam");
        goPlaneFinder     = GameObject.Find("Plane Finder");
        goProtractor      = GameObject.Find("Protractor");
        //
        textLogo    = GameObject.Find("TextLogo").GetComponent <Text>();
        udpMgr.port = 26000;
        role        = RoleType.sender;
        textLogMax  = 1500;
        Application.targetFrameRate = 60;
        f8 = "F6";
    }
Ejemplo n.º 3
0
        public void LateUpdate()
        {
            UpdateToolLate();

            if (!_initialized)
            {
                return;
            }

#if UNITY_EDITOR
            // Testing results screen on editor only
            if (Input.GetKeyDown(KeyCode.Q))
            {
                RecordedAccuracy = 0.95f;
                EndLevel();
            }
#endif

            ProgressMgr progressMgr = ProgressMgr.Instance;

            // TODO: Fix sum for node progression.
            int   sum      = 0;
            float accuracy = 0f;

            int index = 0;
            foreach (MarkupBase userMarkup in GetAllUserMarkups())
            {
                if (mystery)
                {
                    sum++;
                    if (progressMgr.UpdateLabel(index, -1f, false))
                    {
                        progressMgr.UpdateLabelPosition(index, CalculateLabelPositionForMarkup(userMarkup));
                    }
                }
                else
                {
                    if (userMarkup.percent >= progressMgr.PassThreshold.Value)
                    {
                        // Add to accuracy amount.
                        accuracy += userMarkup.percent;
                        sum++;
                    }

                    if (progressMgr.UpdateLabel(index, userMarkup.percent, IsMarkupSelected(userMarkup)))
                    {
                        progressMgr.UpdateLabelPosition(index, CalculateLabelPositionForMarkup(userMarkup));
                    }
                }
                index++;
            }

            if (sum > 0)
            {
                // Calculate overall accuracy.
                RecordedAccuracy = accuracy / sum;
            }
            else
            {
                RecordedAccuracy = 0f;
            }

            for (int i = index; i < progressMgr.transform.childCount; i++)
            {
                progressMgr.UpdateLabel(i, 0, false);
            }

            // If unknown amount of ground truths, then just display sum.
            if (mystery)
            {
                //UIMgr.instance.status.text = "" + sum;
                UIMgr.Instance.UpdateNodeCounters(sum);

                if (sum >= 1)
                {
                    UIMgr.Instance.ShowFinishButton();
                }
            }
            // Otherwise display sum compared to ground truths.
            else
            {
                int groundTruthCount = GetGroundTruthCount();

                //UIMgr.instance.status.text = sum + " / " + groundTruthCount;
                UIMgr.Instance.UpdateNodeCounters(sum, groundTruthCount);
                //Debug.Log(sum + " " + groundTruthCount);

                // If sum is equal to ground truth amount then quit to results page.
                //if (sum >= groundTruthCount)
                if (sum >= 1)
                {
                    UIMgr.Instance.ShowFinishButton();
                }
                else
                {
                    UIMgr.Instance.HideFinishButton();
                }
            }

            UpdateProgressContainer();

            ForceLabelUpdate = false;
        }