Example #1
0
    /* PUBLIC API. */

    public void OnClickRunProgressWall()

    /* Moves the camera to view the wall the run overview is on. This function is
     * registered as handler for when the wall is clicked.
     */
    {
        CameraView nextView = skillCreationCameraView.currentView == CameraView.Left
            ? CameraView.Start
            : CameraView.Left;

        skillCreationCameraView.setView(nextView);
    }
Example #2
0
    public void OnPointerClick(PointerEventData ped)
    {
        if (interfightCameraView.currentView == CameraView.Start)
        // Not viewing a wall yet. Any click here brings the view to this wall.
        {
            interfightCameraView.setView(CameraView.Right);
        }
        else if (interfightCameraView.currentView == CameraView.Right)
        // Already viewing this wall. Clicks here can do actual skill creation logic.
        {
            GameObject clickedObj = ped.rawPointerPress;

            if (clickedObj == imageInputTextObj || clickedObj == imageInputImageObj)
            // Toggle the image options scroll view open or closed.
            {
                bool isOpening = !imageOptionsObj.activeSelf;
                // Show the image options overlay.
                imageOptionsObj.SetActive(isOpening);
                // Update the button text (only visible if not image selected yet).
                string text     = isOpening ? "X" : "Select image...";
                int    fontSize = isOpening ? 50 : 24;
                imageInputTextObj.GetComponent <Text>().text     = text;
                imageInputTextObj.GetComponent <Text>().fontSize = fontSize;
                // Move the image options overlay to be top-level in the UI hierarchy,
                // and last, so that it appears in front of the rest. (Doing this in
                // script so in editor it can still be child of the appropriate object,
                // and if that object moves around this one will follow accordingly.)
                imageOptionsObj.transform.SetParent(transform);
                imageOptionsObj.transform.SetAsLastSibling();
            }
            else if (clickedObj.name.Contains("ImageOption_"))
            // Select a new image for this skill.
            {
                Sprite clickedImage = clickedObj.GetComponent <Image>().sprite;

                skillCreationState.setEditedImage(clickedImage);

                imageInputTextObj.SetActive(false);
                imageInputImageObj.SetActive(true);
                imageInputImageObj.GetComponent <Image>().sprite = clickedImage;
                imageInputImageObj.GetComponent <Image>().DOFade(1, 1).From(0);

                imageOptionsObj.SetActive(false);
            }
        }
    }
 public void OnPointerClick(PointerEventData ped)
 {
     interfightCameraView.setView(CameraView.Start);
 }