Пример #1
0
        //Calculations for Echelon 1, returns an int array (all of the rest are basically copies, but for each echelon)
        //You'll realize why I did it this way soon, yes it could be done differently and it will eventually.
        private int[] CalcE1()
        {
            //Create a Logistic, and initialize it.
            Logistic logi = null;
            //vars to hold our information from logi, we technically dont *need* them but I'm lazy.
            int    man, ammo, rations, parts;
            Drop   d1, d2;
            double time;

            //We have to reset the output text, but we dont want to call Reset()
            labelE1Resources.Text = "";
            labelE1Rewards.Text   = "";

            //Resources
            //Get a Logistic from our selected chapter and map, they are stored locally for debugging reasons
            logi = GetLogisticFromNum(comboE1Chapter.SelectedIndex, comboE1Map.SelectedIndex);

            man     = logi.Manpower;
            ammo    = logi.Ammunition;
            rations = logi.Rations;
            parts   = logi.Parts;
            time    = logi.Time;

            //We have to divide by 60, because we are in minutes, needs to be hours
            String sTime = GetTimeFormat(time / 60);

            labelE1Resources.Text = "" + "ManP: " + man + " | Ammo: " + ammo + " | Rations: " + rations +
                                    " | Parts: " + parts + " | Time: " + sTime;

            //Drops
            //Basically we get the drop from the Logisitic, if no drop then emptyDrop
            //We can call it this way, due to the static nature of the variable
            if (logi.NumOfDrops == 1)
            {
                d1 = logi.GetDrop(1);
                d2 = Mission.emptyDrop;
            }
            else if (logi.NumOfDrops == 2)
            {
                d1 = logi.GetDrop(1);
                d2 = logi.GetDrop(2);
            }
            else
            {
                d1 = Mission.emptyDrop;
                d2 = Mission.emptyDrop;
            }

            labelE1Rewards.Text = "Potential Rewards: " + GetTextFromDrop(d1) + GetTextFromDrop(d2);

            // Okay, to explain the array: when we get the total of all resources, gotta send it back somehow and
            // normally we can't return > 1 object, so we return an array containing all the useful stuff
            // time is an int now, since it doesnt have decimal places/etc.
            int[] data = new int[] { man, ammo, rations, parts, (int)time };
            return(data);
        }
Пример #2
0
        private int[] CalcE3()
        {
            Logistic logi = null;
            int      man, ammo, rations, parts;
            Drop     d1, d2;
            double   time;

            labelE3Resources.Text = "";
            labelE3Rewards.Text   = "";

            //Resources
            logi = GetLogisticFromNum(comboE3Chapter.SelectedIndex, comboE3Map.SelectedIndex);

            man     = logi.Manpower;
            ammo    = logi.Ammunition;
            rations = logi.Rations;
            parts   = logi.Parts;
            time    = logi.Time;

            String sTime = GetTimeFormat(time / 60);

            labelE3Resources.Text = "" + "ManP: " + man + " | Ammo: " + ammo + " | Rations: " + rations +
                                    " | Parts: " + parts + " | Time: " + sTime;

            //Drops
            if (logi.NumOfDrops == 1)
            {
                d1 = logi.GetDrop(1);
                d2 = Mission.emptyDrop;
            }
            else if (logi.NumOfDrops == 2)
            {
                d1 = logi.GetDrop(1);
                d2 = logi.GetDrop(2);
            }
            else
            {
                d1 = Mission.emptyDrop;
                d2 = Mission.emptyDrop;
            }

            labelE3Rewards.Text = "Potential Rewards: " + GetTextFromDrop(d1) + GetTextFromDrop(d2);

            int[] data = new int[] { man, ammo, rations, parts, (int)time };
            return(data);
        }