Example #1
0
        public void Initialize(Camera camera, int animationId, string message, Action <int> callback)
        {
            this.gameObject.name = "PromptDialog";

            canvas.worldCamera   = camera;
            this.onClickCallback = callback;


            GameObject messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject;

            messageBoxBase.transform.localPosition = new Vector2(0, -150);
            Clickable clickable = messageBoxBase.AddComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            localizedMessage = message;

            localizedMessage = localizedMessage.Replace("#", "\r\n");
            datoControl      = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(messageBoxBase.transform, animationId, new Vector2(-230, -150), true);

            textObj = FontAssets.ComposeTextMeshObject(localizedMessage);


            Transform textAnchor = this.transform.Find("Canvas/TextAnchor");

            textObj.transform.parent        = textAnchor;
            textObj.transform.localPosition = new Vector3(0, 0, 0);
            textObj.transform.localScale    = new Vector3(5, 5, 1);
            textObj.gameObject.layer        = 5;
            // textObj.fontSize = 20;

            displayLength = 4;
            textObj.text  = localizedMessage.Substring(0, 4);
        }
Example #2
0
        public void Initialize(Camera camera, FDCreature creature, ShowType showType, Action <int> callback)
        {
            this.gameObject.name = "CreatureDialog";

            canvas.worldCamera = camera;
            this.camera        = camera;

            this.creature   = creature;
            this.showType   = showType;
            this.onCallback = callback;

            containerBase = this.transform.Find("Canvas/ContainerBase");
            Clickable clickable = containerBase.GetComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            creatureDetailBase = this.transform.Find("Canvas/CreatureDetail");
            clickable          = creatureDetailBase.gameObject.GetComponent <Clickable>();
            clickable.Initialize(() => { this.OnCancelled(); });
            datoBase    = this.transform.Find("Canvas/DatoBase");
            datoControl = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(datoBase, creature.Definition.AnimationId, new Vector2(0, 0));
            //// datoControl.transform.localPosition = new Vector3(0, 0, 0);

            RenderDetails();

            if (IsItemDialog)
            {
                RenderItemsContainer();
            }
            else
            {
                RenderMagicsContainer();
            }
        }
Example #3
0
        public void Initialize(Camera camera, Vector2 popupPosition, int animationId, string message, Action <int> callback, int forChapterId = 0)
        {
            this.gameObject.name = "MessageDialog";

            canvas.worldCamera   = camera;
            this.onClickCallback = callback;

            if (animationId > 500)
            {
                dialogPosition = MessageDialogPosition.UP;
            }

            messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject;
            messageBoxBase.transform.localPosition = GetBasePosition(dialogPosition);
            Clickable clickable = messageBoxBase.GetComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            PopUp popUp = messageBoxBase.GetComponent <PopUp>();

            popUp.Initialize(popupPosition);

            localizedMessage = message;

            localizedMessage = localizedMessage.Replace("#", "\r\n");
            datoControl      = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(messageBoxBase.transform, animationId, GetDatoPosition(dialogPosition), (dialogPosition == MessageDialogPosition.DOWN));

            if (forChapterId > 0)
            {
                textObj = FontAssets.ComposeTextMeshObjectForChapter(forChapterId, localizedMessage);
            }
            else
            {
                textObj = FontAssets.ComposeTextMeshObject(localizedMessage);
            }

            Transform textAnchor = this.transform.Find("Canvas/MessageBase/TextAnchor");

            textAnchor.localPosition = GetTextPosition(dialogPosition);

            textObj.transform.parent = textAnchor;
            //textObj.transform.localPosition = new Vector2(190, -50);
            textObj.transform.localPosition = new Vector3(0, 0, 0);
            textObj.transform.localScale    = new Vector3(5, 5, 1);
            textObj.gameObject.layer        = 5;
            // textObj.fontSize = 20;

            displayLength = 1;
            textObj.text  = localizedMessage.Substring(0, 1);
        }