コード例 #1
0
    void DisplayInputInfo()
    {
        if (CurrentSelector == "FirstItem")
        {
            if (CurrentFisrtItem != "None")
            {
                GoodsRecipe.Recipe TargetRecipe = CallGoodsRecipe.GetRecipe(CurrentFisrtItem);

                FirstItemImageObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetRecipe.Type);
                FirstItemNameTextObject.GetComponent <Text>().text = CurrentFisrtItem;
                FirstItemImageObject.GetComponent <Image>().color  = new Color(1f, 1f, 1f, 1f);
            }
            else
            {
                FirstItemImageObject.GetComponent <Image>().sprite = null;
                FirstItemNameTextObject.GetComponent <Text>().text = "";
                FirstItemImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
            }
        }
        else if (CurrentSelector == "SecondItem")
        {
            if (CurrentSecondItem != "None")
            {
                GoodsRecipe.Recipe TargetRecipe = CallGoodsRecipe.GetRecipe(CurrentSecondItem);

                SecondItemImageObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetRecipe.Type);
                SecondItemNameTextObject.GetComponent <Text>().text = CurrentSecondItem;
                SecondItemImageObject.GetComponent <Image>().color  = new Color(1f, 1f, 1f, 1f);
            }
            else
            {
                SecondItemImageObject.GetComponent <Image>().sprite = null;
                SecondItemNameTextObject.GetComponent <Text>().text = "";
                SecondItemImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
            }
        }
        else if (CurrentSelector == "Processor")
        {
            if (CurrentProcessor != "None")
            {
                ProcessorImageObject.GetComponent <Image>().sprite = null;
                ProcessorNameTextObject.GetComponent <Text>().text = CurrentProcessor.Split('?')[0] + "-" + CurrentProcessor.Split('?')[1];
                ProcessorImageObject.GetComponent <Image>().color  = new Color(1f, 1f, 1f, 1f);
            }
            else
            {
                ProcessorImageObject.GetComponent <Image>().sprite = null;
                ProcessorNameTextObject.GetComponent <Text>().text = "";
                ProcessorImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
            }
        }
    }
コード例 #2
0
    void ClaerInputPanel()
    {
        FirstItemImageObject.transform.parent.gameObject.GetComponent <Button>().interactable  = true;
        SecondItemImageObject.transform.parent.gameObject.GetComponent <Button>().interactable = true;
        ProcessorImageObject.transform.parent.gameObject.GetComponent <Button>().interactable  = true;

        FirstItemImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
        FirstItemNameTextObject.GetComponent <Text>().text = "";
        CurrentFisrtItem = "None";

        SecondItemImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
        SecondItemNameTextObject.GetComponent <Text>().text = "";
        CurrentSecondItem = "None";

        ProcessorImageObject.GetComponent <Image>().color  = new Color(0, 0, 0, 0);
        ProcessorNameTextObject.GetComponent <Text>().text = "";
        CurrentProcessor = "None";
    }