Beispiel #1
0
    public void Build_Mount_Point_Drop_Panels()
    {
        //****************************
        //Get the list of mount points
        //****************************
        GameObject g = null;

        if (this.command_module == null)
        {
            //We need to hide all buttons and only show a command
            SetScreenNoCommandModule();
        }
        else
        {
            if (this.tmp_drop_panel)
            {
                Destroy(this.tmp_drop_panel);
            }
            if (drop_panels_loaded)
            {
                return;
            }
            GameObject mount_points = this.command_module.transform.Find("MountPoints").gameObject;
            ShipModule sys          = mount_points.GetComponentInParent <ShipModule>();
            mount_point_drop_zone_list = new GameObject[sys.mount_points.Count];

            foreach (MountPoint m in sys.mount_points)
            {
                if (m.zone == Enums.emun_zone.intern)
                {
                    g = Instantiate(mount_point_drop_zone_grid, mount_point_panels[(int)m.zone].gameObject.transform);
                }
                else
                {
                    g = Instantiate(mount_point_drop_zone, mount_point_panels[(int)m.zone].gameObject.transform);
                }

                mount_point_drop_zone_list[m.index] = g.transform.Find("DropZone").gameObject;
                MountPoint omp = g.GetComponent <MountPoint>();
                omp.SetValues(m);
                omp.SetSize(new Vector2(100 + (m.max_mounting * 50), 50));
                omp.mount_type_util_top  = m.mount_type_util_top;
                omp.mount_type_util_side = m.mount_type_util_side;
                omp.mount_type_thruster  = m.mount_type_thruster;
                omp.mount_type_engine    = m.mount_type_engine;

                omp.associated_mountpoint = m.gameObject;
                ItemDropHandler dh = g.GetComponentInChildren <ItemDropHandler>();
                dh.enforce_max = true;
                dh.max_items   = m.max_mounting;
            }
            DisableEnableButtons(true);
            Populate_Mount_Point_Drop_Panels();
            Build_Inventory_List_Items();
            drop_panels_loaded = true;
        }
    }