void Start()
    {
        GameObject photoDestinationGuide = GameObject.Find("PhotoDestination");
        PhotoVisualiser photoVisualiser = new PhotoVisualiser();

        ClothingConfig playerClothingConfig = new ClothingConfig();
        playerClothingConfig.setClothing("Head","AV010");
        playerClothingConfig.setClothing("Body","AV04");
        playerClothingConfig.setClothing("Leg","AV01");

        Photo tmpPhotoDetails = new Photo((ApplicationID)System.Enum.ToObject(typeof(ApplicationID),0),0,
                                          new PhotoCharacterElement(8,Random.Range(1,4),null),
                                          new PhotoCharacterElement(0,Random.Range(1,4),null),
                                          new PlayerAvatarSettings("Male",playerClothingConfig),
                                          Random.Range(1,4),
                                          "Test Photo",
                                          null);

        photoVisualiser.producePhotoRender("TestPhoto",tmpPhotoDetails,0.05f,photoDestinationGuide,true);
    }
    public void init(PDBCRemovePhoto para_removePhotoParams, string para_questGiverName)
    {
        int questGiverID = para_removePhotoParams.questGiverID;
        string questGiverName = para_questGiverName;

        // Apply portrait.
        Transform dummyPortrait = transform.FindChild("Portrait");
        PortraitHelper.replaceEntireDummyPortrait(dummyPortrait.gameObject,questGiverID,0,questGiverName,0.04f);
        CommonUnityUtils.setSortingLayerOfEntireObject(dummyPortrait.gameObject,"SpriteGUI");
        CommonUnityUtils.setSortingOrderOfEntireObject(dummyPortrait.gameObject,6000);

        // Apply photo render.
        GhostbookManagerLight gbMang = GhostbookManagerLight.getInstance();
        Photo reqPhoto = gbMang.getPhoto(questGiverID, para_removePhotoParams.langAreaID, para_removePhotoParams.diffIndexInLangArea, para_removePhotoParams.photoDiffPosition);
        PhotoVisualiser pVisualiser = new PhotoVisualiser();
        GameObject nwRenderObj = pVisualiser.producePhotoRender("NewPhotoRender",reqPhoto,0.05f,transform.FindChild("PhotoGuide").gameObject,true);
        CommonUnityUtils.setSortingLayerOfEntireObject(nwRenderObj,"SpriteGUI");
        CommonUnityUtils.setSortingOrderOfEntireObject(nwRenderObj,6000);
        nwRenderObj.transform.parent = transform;

        // Apply gradual fade effect on photo.
        applyFadeAnimationToPhoto(nwRenderObj);
    }
Beispiel #3
0
    private void drawPhoto()
    {
        //Debug.Log(uiBounds.ContainsKey("OkBtn"));

        // Apply photo render.
        PhotoVisualiser pVisualiser = new PhotoVisualiser();
        GameObject nwRenderObj = pVisualiser.producePhotoRender("NewPhotoRender",reqPhoto,0.05f,transform.FindChild("PhotoGuide").gameObject,true);
        CommonUnityUtils.setSortingLayerOfEntireObject(nwRenderObj,"SpriteGUI");
        CommonUnityUtils.setSortingOrderOfEntireObject(nwRenderObj,6000);
        nwRenderObj.transform.parent = transform;
    }
    private void displayPhotoPageView(int para_photoPageIndex)
    {
        contentsPageChild.gameObject.SetActive(false);
        photoPageChild.gameObject.SetActive(true);
        isInContentsView = false;
        isInPageView = true;
        isInCloseupView = false;

        PhotoPage reqPage = availablePhotoPages[para_photoPageIndex];
        currPhotoPage = reqPage;
        currPhotoPageIndex = para_photoPageIndex;

            //int reqLA = currPhotoPage.getLangArea();
            //int reqDiff = currPhotoPage.getDifficulty();

            humanReadableDescText = currPhotoPage.getExplanation();

        // Adjust state of the previous and next buttons.
        Transform prevPageBtn = photoPageChild.FindChild("PreviousPageButton");
        Transform nextPageBtn = photoPageChild.FindChild("NextPageButton");
        prevPageBtn.renderer.enabled = true;
        nextPageBtn.renderer.enabled = false;
        if((availablePhotoPages.Count > 0)&&(currPhotoPageIndex > 0)&&(currPhotoPageIndex < availablePhotoPages.Count))
        {
            prevPhotoPageAvailable = true;
            prevPageBtn.renderer.enabled = true;
        }
        if((availablePhotoPages.Count > 0)&&(currPhotoPageIndex < (availablePhotoPages.Count-1))&&(currPhotoPageIndex >= 0))
        {
            nextPhotoPageAvailable = true;
            nextPageBtn.renderer.enabled = true;
        }

        // Setup page title, bookmark and prev, next buttons.
        if( ! photoPageBoundsLoaded)
        {
            string[] elementNames   = {"PhotoPageTitle","BookmarkTip","PreviousPageButton","NextPageButton","PlayPageButton","NoteScrollArea"};
            string[] elementContent = {"PhotoPageTitle","BookmarkTip","PreviousPage","NextPage","PlayPageButton","NoteScrollArea"};
            bool[] destroyGuideArr = {false,true,false,false,false,true};
            int[] textElementTypeArr = {0,0,0,0,0,0};
            prepTextElements(elementNames,elementContent,destroyGuideArr,textElementTypeArr,photoPageChild.name);
            photoPageBoundsLoaded = true;
        }

        // Setup page number text.
        Transform pageNumber = photoPageChild.FindChild("PageNumber");
        pageNumber.GetComponent<TextMesh>().text = " ";//""+(para_photoPageIndex+1);
        pageNumber.renderer.sortingOrder = 1110;

        // Setup photos on the page.

        PhotoVisualiser pVisualiser = new PhotoVisualiser();

        int numOfPhotos = reqPage.getNumAvailablePhotos();
        numPhotosOnCurrPage = numOfPhotos;
        Dictionary<int,Photo> availablePhotos = reqPage.getAvailablePhotos();

        for(int i=0; i<4; i++)
        {
            Transform tmpOldPhoto = photoPageChild.FindChild("PhotoPosition"+i);
            if(tmpOldPhoto != null) { 	Destroy(tmpOldPhoto.gameObject); }
            Transform tmpOldCaption = photoPageChild.FindChild("Caption"+i);
            if(tmpOldCaption != null) { Destroy(tmpOldCaption.gameObject); }
        }

        for(int i=0; i<4; i++)
        {
            Transform reqPhotoGuide = photoPageChild.FindChild("PhotoTemplate"+(i+1));
            Transform captionTextGuide = reqPhotoGuide.FindChild("CaptionText");
            captionTextGuide.renderer.enabled = false;

            Transform photoNumber = reqPhotoGuide.FindChild("PhotoNumber");
            photoNumber.GetComponent<TextMesh>().text = ""+ (((currPhotoPageIndex * 4) + i) + 1);
            photoNumber.renderer.sortingOrder = 2011;
            photoNumber.renderer.enabled = true;
        }

        for(int i=0; i<numOfPhotos; i++)
        {
            Transform reqPhotoGuide = photoPageChild.FindChild("PhotoTemplate"+(i+1));
            if((reqPhotoGuide != null)&&(availablePhotos.ContainsKey(i)))
            {
                Photo reqPhoto = availablePhotos[i];

                reqPhotoGuide.parent = null;
                Transform photoBlank = reqPhotoGuide.FindChild("PhotoBlank");
                photoBlank.renderer.enabled = false;
                if( ! uiBounds.ContainsKey("PhotoPosition"+i))
                {
                    uiBounds.Add("PhotoPosition"+i,WorldSpawnHelper.getWorldToGUIBounds(photoBlank.renderer.bounds,upAxisArr));
                }
                GameObject nwPhotoRender = pVisualiser.producePhotoRender("PhotoPosition"+i,reqPhoto,0.025f,photoBlank.gameObject,false);
                CommonUnityUtils.setSortingOrderOfEntireObject(nwPhotoRender,1300);

                reqPhotoGuide.FindChild("SellotapeCorners").renderer.sortingOrder = 2000;
                Transform selloBanner = reqPhotoGuide.FindChild("SellotapeBanner");
                selloBanner.renderer.sortingOrder = 2010;

                Transform captionTextGuide = reqPhotoGuide.FindChild("CaptionText");
                GameObject nwCaptionObj = WordBuilderHelper.buildWordBox(99,reqPhoto.getDateTimeStampStr(),CommonUnityUtils.get2DBounds(captionTextGuide.renderer.bounds),2f,upAxisArr,genericWordBoxPrefab);
                nwCaptionObj.name = "Caption"+i;
                Destroy(nwCaptionObj.transform.FindChild("Board").gameObject);
                nwCaptionObj.transform.FindChild("Text").renderer.sortingOrder = 2011;
                nwCaptionObj.transform.parent = photoPageChild;

                Transform photoNumber = reqPhotoGuide.FindChild("PhotoNumber");
                photoNumber.renderer.enabled = false;

                nwPhotoRender.transform.parent = photoPageChild;
                reqPhotoGuide.parent = photoPageChild;
            }
        }

        triggerSoundAtCamera("PageTurn");
    }
    private void displayCloseupView(int para_photoPosID, Photo para_reqPhotoData)
    {
        isInContentsView = false;
        isInPageView = false;

        Transform closeUpPhotoElement = Resources.Load<Transform>("Prefabs/CloseUpPhotoElement");

        transform.parent = null;
        Transform nwCloseup = (Transform) Instantiate(closeUpPhotoElement,new Vector3(9000,transform.position.y,transform.position.z),Quaternion.identity);
        nwCloseup.name = "Closeup";
        //nwCloseup.renderer.sortingOrder = 1600;
        //nwCloseup.FindChild("PhotoWhiteArea").renderer.sortingOrder = 1601;
        GameObject photoGuideObj = nwCloseup.FindChild("PhotoGuide").gameObject;

        //GameObject reqPhotoObjToCopy = photoPageChild.FindChild("PhotoPosition"+para_photoPosID).gameObject;

        PhotoVisualiser pvis = new PhotoVisualiser();
        GameObject photoRendForCloseup = pvis.producePhotoRender("TmpCloseupPhoto",para_reqPhotoData,0.05f,photoGuideObj,true);

        //GameObject photoRendForCloseup = ((Transform) Instantiate(reqPhotoObjToCopy.transform,photoGuideObj.transform.position,photoGuideObj.transform.rotation)).gameObject;
        //GameObject photoRendBackground = photoRendForCloseup.transform.FindChild("PhotoBackground").gameObject;
        //Rect photoRendBackgroundBounds = CommonUnityUtils.get2DBounds(photoRendBackground.renderer.bounds);
        photoRendForCloseup.transform.localScale = new Vector3(0.5f,0.5f,1f);//new Vector3(photoGuideObj.renderer.bounds.size.x / photoRendBackgroundBounds.width, photoGuideObj.renderer.bounds.size.y / photoRendBackgroundBounds.height, 1);

        //fixAnimationsInCloseup(reqPhotoObjToCopy,photoRendForCloseup,new List<string>() { "PlayerAvatar","QuestGiver","ActivityOwner" });

        photoRendForCloseup.transform.parent = nwCloseup;
        CommonUnityUtils.setSortingLayerOfEntireObject(nwCloseup.gameObject,"SpriteGUI");
        CommonUnityUtils.setSortingOrderOfEntireObject(nwCloseup.gameObject,3600);
        nwCloseup.renderer.sortingOrder = 0;
        nwCloseup.FindChild("PhotoWhiteArea").renderer.sortingOrder = 1;
        nwCloseup.parent = transform;
        transform.parent = Camera.main.transform;

        PhotoVisualiser pVis = new PhotoVisualiser();
        pVis.makeAllCharactersStill(photoRendForCloseup);

        CustomAnimationManager aniMang = nwCloseup.gameObject.AddComponent<CustomAnimationManager>();
        List<List<AniCommandPrep>> batchLists = new List<List<AniCommandPrep>>();
        List<AniCommandPrep> batch1 = new List<AniCommandPrep>();
        batch1.Add(new AniCommandPrep("DelayForInterval",1,new List<System.Object>() { 0.5f }));
        batch1.Add(new AniCommandPrep("TeleportToLocation",1,new List<System.Object>() { new float[3]{transform.position.x,transform.position.y,transform.position.z}}));
        batchLists.Add(batch1);
        aniMang.init(batchLists);

        // Manual Scaling. (Tmp fix).
        nwCloseup.localScale = new Vector3(2,2,1);
        isInCloseupView = true;
    }