protected void endActivity(ApplicationID para_acID, bool para_outcome, GameyResultData para_gameyData, bool para_activityIsIncomplete)
    {
        GameObject poRef = PersistentObjMang.getInstance();
        DatastoreScript ds = poRef.GetComponent<DatastoreScript>();

        if(ds.getData("ActivityOutcome")!=null){//this is a replay
            System.Object[] previousOutcome = (System.Object[])ds.getData("ActivityOutcome");
            ds.removeData("ActivityOutcome");

            System.Object[] dataArr = new System.Object[3];
            dataArr[0] = para_acID;
            dataArr[1] = para_outcome||((bool)previousOutcome[1]);//Either this or previous outcome were positive
            dataArr[2] = para_activityIsIncomplete&&((bool)previousOutcome[2]);//Both games, the activity was incomplete
            ds.insertData("ActivityOutcome",dataArr);

        }else{

        // Store basic info.
            System.Object[] dataArr = new System.Object[3];
            dataArr[0] = para_acID;
            dataArr[1] = para_outcome;
            dataArr[2] = para_activityIsIncomplete;
            ds.insertData("ActivityOutcome",dataArr);

        }

        // Store detailed activity result.
        if(acSessionMetaData != null)
        {
            acSessionMetaData.recordActivityEnd();
            if(acResultData != null)
            {
                acResultData.saveActivitySessionMetaData(acSessionMetaData,para_gameyData);
                //ds.insertData("ActivityResult",acResultData);
            }
        }

        if(( ! para_activityIsIncomplete)
           &&
           ((para_acID == ApplicationID.DROP_CHOPS)
         	||(para_acID == ApplicationID.SERENADE_HERO)
         	||(para_acID == ApplicationID.MOVING_PATHWAYS)
         	||(para_acID == ApplicationID.HARVEST)
         	||(para_acID == ApplicationID.WHAK_A_MOLE)
         	||(para_acID == ApplicationID.MAIL_SORTER)
         	||(para_acID == ApplicationID.EYE_EXAM)
         	||(para_acID == ApplicationID.TRAIN_DISPATCHER)
         	||(para_acID == ApplicationID.ENDLESS_RUNNER))
          )
        {
            // Trigger results screen.

            Transform resultsWindowPrefab = Resources.Load<Transform>("Prefabs/ResultViewerWindow");

            Rect origPrefab2DBounds = CommonUnityUtils.get2DBounds(resultsWindowPrefab.FindChild("WindowBounds").renderer.bounds);
            GameObject nwResultWindow = WorldSpawnHelper.initWorldObjAndBlowupToScreen(resultsWindowPrefab,origPrefab2DBounds);
            nwResultWindow.name = "ResultViewerWindow";
            nwResultWindow.transform.position = new Vector3(Camera.main.transform.position.x,
                                                            Camera.main.transform.position.y,
                                                            Camera.main.transform.position.z + 5f);

            ActivityResultViewer resViewer = null;
            if(para_acID == ApplicationID.DROP_CHOPS)
            {
                resViewer = nwResultWindow.AddComponent<SJResultViewer>();
            }
            else if(para_acID == ApplicationID.SERENADE_HERO)
            {
                resViewer = nwResultWindow.AddComponent<SHResultViewer>();
            }
            else if(para_acID == ApplicationID.MOVING_PATHWAYS)
            {
                resViewer = nwResultWindow.AddComponent<MPResultViewer>();
            }
            else if(para_acID == ApplicationID.HARVEST)
            {
                resViewer = nwResultWindow.AddComponent<HarvestResultViewer>();
            }
            else if(para_acID == ApplicationID.WHAK_A_MOLE)
            {
                resViewer = nwResultWindow.AddComponent<WAMResultViewer>();
            }
            else if(para_acID == ApplicationID.MAIL_SORTER)
            {
                resViewer = nwResultWindow.AddComponent<MSResultViewer>();
            }
            else if(para_acID == ApplicationID.EYE_EXAM)
            {
                resViewer = nwResultWindow.AddComponent<BBResultViewer>();
            }
            else if(para_acID == ApplicationID.TRAIN_DISPATCHER)
            {
                resViewer = nwResultWindow.AddComponent<TDResultViewer>();
            }
            else if(para_acID == ApplicationID.ENDLESS_RUNNER)
            {
                resViewer = nwResultWindow.AddComponent<PDResultViewer>();
            }

            if(resViewer != null)
            {
                resViewer.registerListener("AcScen",this);
                resViewer.init(acResultData);
            }

            pauseScene(true);
        }
        else
        {
            exitActivityScene();
        }
    }
Exemplo n.º 2
0
 public void saveActivitySessionMetaData(ActivitySessionMetaData para_acMetaData, GameyResultData para_gData)
 {
     acMetaData = para_acMetaData;
     gameyData = para_gData;
 }