// Use this for initialization
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Debug.LogError("Try Create multiple ConstructionModuleMain ");
            return;
        }

        DeleteButtonLoadPanel = GameObject.Find("Delete").GetComponent <Button>();
        DeleteButtonLoadPanel.interactable = false;
        SelectButtonLoadPanel = GameObject.Find("Select").GetComponent <Button>();
        SelectButtonLoadPanel.interactable = false;
        CancelButtonLoadPanel = GameObject.Find("Cancel").GetComponent <Button>();


        loadPageShip = GameObject.Find("LoadList");
        listParent   = GameObject.Find("ViewContentLoadList");
        loadPageShip.SetActive(false);

        toggleGroupLoad  = GameObject.Find("TogglesGroupLoadPanel");
        togglePrefabLoad = Resources.Load <GameObject>("Vessels_Parts/UI/PrefabToggleLoadPanel");

        if (ToggleDictionnary == null)
        {
            ToggleDictionnary = new Dictionary <string, ToggleTextureLink>();
        }

        UpdateLoadPanel();
    }
    public void OnSelect(BaseEventData eventData)
    {
        Button refButton = gameObject.GetComponent <Button>();

        gameObject.GetComponent <Image>().material = privateMatOn;

        if (!refButton.interactable)
        {
            refButton.targetGraphic.color = refButton.colors.highlightedColor;
        }

        Navigation nav = refButton.navigation;
        int        indexOn;

        if (LoadShipManagement.GetSingleton().HasPanelOn(out indexOn))
        {
            nav.selectOnLeft = parentContent.transform.GetChild(indexOn).GetComponent <Toggle>();
        }
        else
        {
            if (parentContent.transform.childCount > 0)
            {
                float t     = parentContent.GetComponent <VerticalLayoutGroup>().padding.top;
                float index = (-t + StartUpValue) / (2 * height);

                nav.selectOnLeft = parentContent.transform.GetChild((int)index).GetComponent <Toggle>();
            }
            else
            {
                nav.selectOnLeft = null;
            }
        }
        refButton.navigation = nav;
    }
Beispiel #3
0
    // Use this for initialization
    void Awake()
    {
        GameObject ship = LoadShipManagement.LoadShipOneBlock("PrefabSave/MB/Imperium_t1");

        ship.tag = "Enemy";
        ship.transform.parent        = transform;
        ship.transform.localPosition = Vector3.zero;
    }
    // Use this for initialization
    void Awake()
    {
        GameObject temp = LoadShipManagement.LoadShip(GameManager.nameVessel);

        temp.transform.SetParent(GameObject.Find("Ship").transform);
        temp.GetComponent <WeaponShootManager>().GetShipReference(GameObject.Find("Ship").GetComponent <Ship>());

        introDone = false;
        saveCoro  = StartCoroutine(TempoFadeIn());

        colliders = GameObject.Find("Ship").GetComponentsInChildren <MeshCollider>();
        foreach (MeshCollider mc in colliders)
        {
            mc.enabled = false;
        }
    }
Beispiel #5
0
    // Use this for initialization
    void Awake()
    {
        if (LoadPath == null)
        {
            LoadPath = "PrefabSave/NoneMB/";
        }

        if (arrayOfID == null)
        {
            TextAsset asset = Resources.Load <TextAsset>(LoadPath + "ID");
            JObject   data  = JObject.Parse(asset.text);
            JArray    IDs   = data["uniqueID"].Value <JArray>();
            arrayOfID = new string[IDs.Count];
            for (int i = 0; i < arrayOfID.Length; i++)
            {
                arrayOfID[i] = IDs[i].Value <string>();
            }
        }

        int        randValue = Random.Range(0, arrayOfID.Length);
        GameObject ship      = LoadShipManagement.LoadShip("Ally_" + allyNumberCount, 1, LoadPath + arrayOfID[randValue]);

        allyNumberCount++;
        ship.tag = "Ally";
        ship.transform.parent        = transform;
        ship.transform.localPosition = Vector3.zero;
        MeshCollider[] colliders = GetComponentsInChildren <MeshCollider>(true);
        foreach (MeshCollider mc in colliders)
        {
            mc.enabled = true;
        }

        /*MeshFilter[] filters = GetComponentsInChildren<MeshFilter>();
         * foreach (MeshFilter mf in filters)
         * {
         *      MeshCollider mesh = mf.gameObject.AddComponent<MeshCollider>();
         *      mesh.sharedMesh = mf.sharedMesh;
         *      mesh.inflateMesh = true;
         *      mesh.convex = true;
         * }
         * // UNTIL WE HAVE TEXTURES
         * MeshRenderer[] renderers = GetComponentsInChildren<MeshRenderer>();
         * foreach (MeshRenderer mr in renderers)
         * {
         *      mr.material.color = GetComponent<Enemy>() != null ? new Color(1f, 0.25f, 0f) : Color.blue;
         * }*/
    }
Beispiel #6
0
 public void OnCancel(BaseEventData eventData)
 {
     LoadShipManagement.GetSingleton().CancelLoadPanel();
 }
Beispiel #7
0
 public void OnSubmit(BaseEventData eventData)
 {
     this.GetComponent <Toggle>().isOn = true;
     EventSystem.current.SetSelectedGameObject(null);
     EventSystem.current.SetSelectedGameObject(LoadShipManagement.GetSingleton().CancelButtonLoadPanel.gameObject);
 }