Ejemplo n.º 1
0
 private void PlayerEnterBenchArea(AreaBase area)
 {
     if (area.GetData("rbMod_Id", out Guid benchId))
     {
         CurBench    = BenchManager.GetBench(benchId);
         CanUseBench = CurBench == null ? false : (CurBench.Owner == Character.Unknown || CurBench.Owner == Util.GetCharacterFromModel(Game.Player.Character.Model.Hash));
     }
 }
Ejemplo n.º 2
0
    public SynergyObject(Synergy syn, Transform WidgetTransform, SynergyWidget WidgetScript)
    {
        synergy         = syn;
        widgetTransform = WidgetTransform;
        widgetScript    = WidgetScript;

        uniqueActiveUnits  = 0;
        uniqueTotalUnits   = 0;
        benchManagerScript = BenchManager.Instance;
    }
Ejemplo n.º 3
0
        private void Main_Aborted(object sender, EventArgs e)
        {
            // Unsub NativeUI events
            if (BenchMain != null)
            {
                BenchMain.OnItemSelect -= BenchMain_OnItemSelect;
            }

            if (BenchList != null)
            {
                BenchList.OnItemSelect -= BenchList_OnItemSelect;
            }

            if (AmountItem != null)
            {
                AmountItem.Activated -= AmountItem_Activated;
            }

            if (ConfirmItem != null)
            {
                ConfirmItem.Activated -= ConfirmItem_Activated;
            }

            // Clear managers
            AmmoTypeManager.Clear();
            MaterialManager.Clear();
            ConversionManager.Clear();

            // Unsub area events before nuking benches
            foreach (Bench bench in BenchManager.Benches)
            {
                if (bench.Area != null)
                {
                    bench.Area.PlayerEnter -= PlayerEnterBenchArea;
                    bench.Area.PlayerLeave -= PlayerLeaveBenchArea;
                }
            }

            BenchManager.Clear();

            // Other clean-up
            CurCraftingAmounts.Clear();
            MaterialMenuItems.Clear();

            CurCraftingAmounts = null;
            MaterialMenuItems  = null;
        }
Ejemplo n.º 4
0
    public void AdjustmentFromUpgrade(string unitName)
    {
        //set this reference if we havent already
        if (!benchManagerScript)
        {
            benchManagerScript = BenchManager.Instance;
        }

        //search our list to find our unique pawn entry for this particular pawn
        foreach (UniqueUnit entry in totalUnits)
        {
            if (entry.name == unitName)
            {
                entry.count -= (benchManagerScript.UnitsNeededForCombo);

                break;
            }
        }
        uniqueTotalUnits = totalUnits.Count;
    }
Ejemplo n.º 5
0
        public Main()
        {
            // Initialize managers
            AmmoTypeManager.Init();
            MaterialManager.Init();
            ConversionManager.Init();
            BenchManager.Init();

            // NativeUI
            Point          noBannerOffset = new Point(0, -107);
            UIResRectangle emptyBanner    = new UIResRectangle(Point.Empty, Size.Empty, Color.Empty);

            // Main menu
            BenchMain = new UIMenu(string.Empty, "SELECT AN OPTION", noBannerOffset);
            BenchMain.SetBannerType(emptyBanner);

            // Generic list menu for displaying ammo types/bench materials, subtitle changes with BenchMain item selection
            BenchList = new UIMenu(string.Empty, "LIST MENU TITLE", noBannerOffset);
            BenchList.SetBannerType(emptyBanner);

            // Action menu, subtitle changes with BenchList item selection
            BenchAction = new UIMenu(string.Empty, "ACTION MENU TITLE", noBannerOffset);
            BenchAction.SetBannerType(emptyBanner);

            MaterialHeader = new UIMenuColoredItem("~b~MATERIAL", Color.Transparent, Color.Transparent);
            MaterialHeader.SetRightLabel("~b~BENCH");
            MaterialHeader.Enabled = false;

            // Amount button
            AmountItem = new UIMenuItem("Amount");
            AmountItem.SetRightLabel("Select...");

            // Confirm button
            ConfirmItem = new UIMenuItem("Confirm");
            ConfirmItem.SetLeftBadge(UIMenuItem.BadgeStyle.Tick);

            // Separators
            MaterialSeparator         = new UIMenuColoredItem("TITLE", Color.Black, Color.Black);
            MaterialSeparator.Enabled = false;

            ActionSeparator         = new UIMenuColoredItem("~b~ACTION", Color.Black, Color.Black);
            ActionSeparator.Enabled = false;

            // Menu relations
            BenchMain.BindMenuToItem(BenchList, new UIMenuItem("Craft Ammo"));
            BenchMain.BindMenuToItem(BenchList, new UIMenuItem("Dismantle Ammo"));
            BenchMain.BindMenuToItem(BenchList, new UIMenuItem("Bench Materials"));

            // Add menus to the menupool
            MenuPool.Add(BenchMain);
            MenuPool.Add(BenchList);
            MenuPool.Add(BenchAction);

            // Menu events
            BenchMain.OnItemSelect += BenchMain_OnItemSelect;
            BenchList.OnItemSelect += BenchList_OnItemSelect;
            AmountItem.Activated   += AmountItem_Activated;
            ConfirmItem.Activated  += ConfirmItem_Activated;

            // Events
            Tick    += Main_Tick;
            Aborted += Main_Aborted;
        }