public override String ToString()
    {
        String resultString = "";

        if (charState == null)
        {
            resultString += "[charState:null, ";
        }
        else
        {
            resultString += "[charState:" + charState.name + ", ";
        }

        if (sector == null)
        {
            resultString += "sector:null, ";
        }
        else
        {
            resultString += "sector:" + sector.getName() + ", ";
        }

        if (location == null)
        {
            resultString += "location:null]";
        }
        else
        {
            resultString += "location:" + location.getName() + "]";
        }
        return(resultString);
    }
Beispiel #2
0
    private void addSectorToContainer(SectorState sectorState, int sectorIndex)
    {
        GameObject currLocationObj = Instantiate(sectorPointPrefab, new Vector3(), new Quaternion()) as GameObject;

        // Реакция на нажатие
        GameObject SecButton = currLocationObj.transform.FindChild("Button").gameObject;

        SecButton.GetComponent <Button> ().onClick.AddListener(() => onSectorClickListener(sectorState));

        // Текст
        GameObject SecText       = SecButton.transform.FindChild("Text").gameObject;
        string     secHiddenMark = sectorState.isVisible ? "" : "[*] ";

        SecText.GetComponent <Text> ().text = secHiddenMark + sectorState.getName();

        // Позиционирование
        RectTransform AnswRT = currLocationObj.GetComponent <RectTransform> ();

        AnswRT.SetParent(sectorsContainer);
        AnswRT.localScale = new Vector3(1, 1, 1);
        AnswRT.anchorMin  = sectorState.getNormalCoords();
        AnswRT.anchorMax  = AnswRT.anchorMin;
        AnswRT.offsetMax  = new Vector2(0, 0);
        AnswRT.offsetMin  = new Vector2(0, 0);
    }