示例#1
0
    private void SetupSceneEdit()
    {
        //Entering scene from: rewards_list

        if (!controller.IsThereACurrentPhoto())
        {
            Debug.Log(CLASSNAME + "***** Current Photo not set");
            //Send request for data to controller
            DO_Reward reward = controller.RequestRewardToEdit();
            if (reward.Equals(null))
            {
                Debug.LogError(CLASSNAME + "Error retrieving Reward to edit");
            }
            rewardName      = reward.reward_name;
            editId          = reward.id;
            titleLabel.text = TITLE_EDIT;
            saveButton.GetComponentInChildren <Text>().text = "Update";
            bool result = controller.CheckForRewardImage(rewardName);

            Debug.Log(CLASSNAME + "***** Does Photo Exist: " + result.ToString());
        }

        /*
         * Entering scene from: reward_camera
         */
        else
        {
            Debug.Log(CLASSNAME + "***** Current Photo set");
            //Original scene entry by Edit
            if (controller.KeyToEdit != "")
            {
                rewardName      = controller.KeyToEdit;
                titleLabel.text = TITLE_EDIT;
            }
            //Original scene entry by Add New
            else
            {
                rewardName      = controller.NewRewardName;
                titleLabel.text = TITLE_ADD;
            }
        }


        //Set UI for editing
        inputFieldObj.SetActive(false);
        rewardNameTextObj.SetActive(true);
        rewardNameTextObj.GetComponent <Text>().text = rewardName;
        Debug.Log("***** REWARD NAME: " + rewardName);
        //Disable save button
        saveButton.interactable = false;
    }
    private void SetupSceneEdit()
    {
        /*
         * Entering scene from: rewards_list
         */

        //Send request for data to controller
        DO_Reward reward = controller.RequestRewardToEdit();

        rewardName = reward.reward_name;
        rewardUrl  = controller.RequestWebRewardUrl();
        Debug.Log("reward name: " + reward.reward_name + ", reward type: " + reward.reward_type + ", reward url: " + reward.reward_url);

        editId          = reward.id;
        titleLabel.text = TITLE_EDIT;
        saveButton.GetComponentInChildren <Text>().text = "Update";

        if (!controller.IsThereACurrentPhoto())
        {
            Debug.Log(CLASSNAME + "***** Current Photo not set");

            if (reward.Equals(null))
            {
                Debug.LogError(CLASSNAME + "Error retrieving Reward to edit");
            }

            bool result = controller.CheckForRewardImage(rewardName);
            Debug.Log(CLASSNAME + "***** Does Photo Exist: " + result.ToString());
        }



        //Set up UI for editing
        inputFieldObj.SetActive(false);
        rewardNameTextObj.SetActive(true);
        rewardNameTextObj.GetComponent <Text>().text = rewardName;
        Debug.Log("***** REWARD NAME: " + rewardName);


        currentUrl.text = rewardUrl;

        Debug.Log("////////// REWARD URL: " + rewardUrl);

        //Disable save button
        saveButton.interactable = false;
    }