Ejemplo n.º 1
0
    public StationDesignDataListEntry(Rect rectangle, StationDesignData design, ButtonPress callback)
    {
        rect           = rectangle;
        Design         = design;
        buttonCallBack = callback;
        Name           = Design.Design.Name + "  ";

        Money = new GUIContent();

        GameManager.instance.UIContent.image = null;
        GameManager.instance.UIContent.text  = Name;

        Money.image = ResourceManager.GetIconTexture("Icon_Money");
        Money.text  = ":" + Design.GetTotalValue().ToString("0.#");

        float nameWidthMax;
        float nameWidthMin;
        float moneyWidthMax;
        float moneyWidthMin;

        GameManager.instance.largeLabelStyle.CalcMinMaxWidth(GameManager.instance.UIContent, out nameWidthMin, out nameWidthMax);
        GameManager.instance.largeLabelStyle.CalcMinMaxWidth(Money, out moneyWidthMin, out moneyWidthMax);

        float indent = (rect.width - (nameWidthMax + moneyWidthMax)) / 2f;

        NameRect  = new Rect(rect.x + indent, rect.y, nameWidthMax, rect.height);
        MoneyRect = new Rect(NameRect.xMax, rect.y, moneyWidthMax, rect.height);
    }
Ejemplo n.º 2
0
    protected void BuildStationDesignDataList(StationHullData hullData)
    {
        StationDesignDataList.Clear();
        DeselectDesignData();

        float EntrySize = DesignScrollWindowRect.height / 5f;

        if (ResourceManager.stationDesigns.ContainsKey(hullData.Name))
        {
            if (ResourceManager.stationDesigns[hullData.Name].Count > 0)
            {
                foreach (KeyValuePair <string, StationDesign> keyVal in ResourceManager.stationDesigns[hullData.Name])
                {
                    if (!keyVal.Value.Deleted)
                    {
                        Rect rect = new Rect(0, EntrySize * StationDesignDataList.Count, DesignScrollViewRect.width, EntrySize);
                        StationDesignData          stationDesignData = ResourceManager.GetStationDesignData(keyVal.Value);
                        StationDesignDataListEntry DLE = new StationDesignDataListEntry(rect, stationDesignData, LoadStationDesignData);
                        StationDesignDataList.Add(DLE);
                    }
                }
            }
        }

        ResizeViewListWindow(ref DesignScrollViewRect, DesignScrollWindowRect, DesignDataList.Count, EntrySize);
    }
Ejemplo n.º 3
0
    public StationData(StationDesignData data)
    {
        designData  = data;
        DisplayName = designData.Design.Name;

        //Add Fighters
        foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.Fighters)
        {
            Fighters.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }
        foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.HeavyFighters)
        {
            HeavyFighters.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }
        foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.AssaultPods)
        {
            AssaultPods.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }

        ammo            = designData.Ammo;
        ammoMax         = designData.Ammo;
        power           = designData.PowerStorage;
        powerMax        = designData.PowerStorage;
        crew            = designData.Crew;
        crewMax         = designData.Crew;
        troops          = designData.Troops;
        troopsMax       = designData.Troops;
        powerGenerated  = designData.PowerGenerated;
        research        = designData.Research;
        mining          = designData.Mining;
        repair          = designData.Repair;
        ammoGenerated   = designData.AmmoGenerated;
        transporter     = designData.Transporter;
        medical         = designData.Medical;
        boardingDefense = designData.BoardingDefense;
        diplomacy       = designData.Diplomacy;
        sensor          = designData.Sensor;
        longRangeSensor = designData.LongRangeSensor;
        advancedSensor  = designData.AdvancedSensor;

        health              = designData.Health;
        healthMax           = designData.Health;
        armorHealth         = designData.ArmorHealth;
        armorHealthMax      = designData.ArmorHealth;
        armorRating         = designData.ArmorRating;
        shieldHealth        = designData.ShieldHealth;
        shieldHealthMax     = designData.ShieldHealth;
        shieldRating        = designData.ShieldRating;
        shieldRechargeRate  = designData.ShieldRechargeRate;
        shieldRechargeDelay = designData.ShieldRechargeDelay;

        SetCrewEffeciency();

        foreach (SavedWeapon savedWeapon in designData.Weapons)
        {
            Weapons.Add(new AttachedWeapon(savedWeapon.weapon));
        }
    }
Ejemplo n.º 4
0
 protected override void LoadStationDesignData(StationDesignData designData)
 {
     selectedStationDesign = designData;
     CreateDummyStation();
     if (PlayerSelected)
     {
         DummyUnit.transform.GetChild(0).gameObject.layer = 9;
     }
     else if (EnemySelected)
     {
         DummyUnit.transform.GetChild(0).gameObject.layer = 10;
     }
     else if (AllySelected)
     {
         DummyUnit.transform.GetChild(0).gameObject.layer = 11;
     }
     else if (NeutralSelected)
     {
         DummyUnit.transform.GetChild(0).gameObject.layer = 13;
     }
 }
Ejemplo n.º 5
0
    public void Draw(StationDesignData selected)
    {
        if (selected == Design)
        {
            if (GUI.Button(rect, "", GameManager.instance.SquareButtonGreenStyle))
            {
                buttonCallBack(Design);
                AudioManager.instance.PlayUIClip("SelectButtonClick");
            }
        }
        else
        {
            if (GUI.Button(rect, ""))
            {
                buttonCallBack(Design);
                AudioManager.instance.PlayUIClip("SelectButtonClick");
            }
        }

        GUI.Label(NameRect, Name, GameManager.instance.largeLabelStyle);
        GUI.Label(MoneyRect, Money, GameManager.instance.largeLabelStyle);
    }
Ejemplo n.º 6
0
 protected override void LoadStationDesignData(StationDesignData designData)
 {
     selectedStationDesign = designData;
     CreateDummyStation();
 }
Ejemplo n.º 7
0
 protected abstract void LoadStationDesignData(StationDesignData designData);