예제 #1
0
 internal static void Postfix(AlterraShippingTarget __instance)
 {
     if (AlterraShippingTargetDestroyed != null)
     {
         AlterraShippingTargetDestroyed.Invoke(__instance);
     }
 }
        private void LoadShippingDisplay(AlterraShippingTarget storageItemName)
        {
            if (storageItemName.GetInstanceID() == _mono.GetInstanceID())
            {
                return;
            }

            QuickLogger.Debug("Load Shipping Display");
            if (storageItemName == null)
            {
                return;
            }
            GameObject itemDisplay = Instantiate(AlterraShippingBuildable.ItemPrefab);

            itemDisplay.transform.SetParent(_itemsGrid.transform, false);
            var text = itemDisplay.transform.Find("Location_LBL").GetComponent <Text>();

            text.text = storageItemName.Name;

            var itemButton = itemDisplay.AddComponent <InterfaceButton>();

            itemButton.ButtonMode     = InterfaceButtonMode.TextColor;
            itemButton.Tag            = storageItemName;
            itemButton.TextComponent  = text;
            itemButton.OnButtonClick += OnButtonClick;
            itemButton.BtnName        = "ShippingContainer";
        }
        internal void Setup(AlterraShippingTarget mono)
        {
            if (!_coroutineStarted)
            {
                base.InvokeRepeating(nameof(UpdateDisplay), DelayedStartTime * 3f, RepeatingUpdateInterval);
            }

            DisplayLanguagePatching.AdditionPatching();


            _mono = mono;

            if (FindAllComponents() == false)
            {
                QuickLogger.Error("// ============== Error getting all Components ============== //");
                return;
            }


            if (_mono == null)
            {
                QuickLogger.Error("CubeGeneratorMono component not found on the GameObject.");
                return;
            }

            if (_mono.GetTransferHandler() == null)
            {
                QuickLogger.Error($"Transfer Handler is returning null.");
                return;
            }

            _animatorController = _mono.AnimatorController;

            if (_mono != null)
            {
                _mono.OnReceivingTransfer += OnReceivingTransfer;
            }
            if (_mono != null)
            {
                _mono.OnTimerChanged += OnTimerChanged;
            }
            if (_mono != null)
            {
                _mono.OnItemSent += OnItemSent;
            }
            _initialized = true;

            _serializedColors = ColorList.Colors;


            CheckCurrentPage();

            DrawPage(1);

            DrawColorPage(1);

            ShippingTargetManager.GlobalChanged += GlobalChanged;

            InvokeRepeating("UpdateStatus", 1f, 0.5f);
        }
 public void AddShippingTarget(AlterraShippingTarget shippingTarget)
 {
     if (!ShippingTargets.Contains(shippingTarget) && shippingTarget.IsConstructed)
     {
         ShippingTargets.Add(shippingTarget);
         QuickLogger.Debug($"Add Shipping Target : {shippingTarget.ID}", true);
         UpdateGlobalTargets();
     }
 }
 internal static void RemoveShippingTarget(AlterraShippingTarget shippingTarget)
 {
     foreach (ShippingTargetManager manager in Managers)
     {
         if (!manager.ShippingTargets.Contains(shippingTarget))
         {
             continue;
         }
         manager.ShippingTargets.Remove(shippingTarget);
         manager.UpdateGlobalTargets();
         QuickLogger.Debug($"Removed Shipping Target : {shippingTarget.ID}", true);
     }
 }
        internal AlterraShippingContainer(AlterraShippingTarget target)
        {
            _isContstructed = () => target.IsConstructed;

            _target = target;

            if (_containerRoot == null)
            {
                QuickLogger.Debug("Initializing StorageRoot");
                var storageRoot = new GameObject("StorageRoot");
                storageRoot.transform.SetParent(target.transform, false);
                _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>();
            }

            CreateNewContainer();
        }
        private IEnumerator ShippingScreenEnu(AlterraShippingTarget target)
        {
            yield return(new WaitForEndOfFrame());

            GoToPage(Pages.Shipping);

            if (target == null)
            {
                yield break;
            }
            var shipping = _mono.TransferItems(target);

            if (shipping)
            {
                _sender             = true;
                _mono.ContainerMode = ShippingContainerStates.Shipping;
            }
        }
        private IEnumerator ShippingScreenEnu(AlterraShippingTarget target)
        {
            yield return(new WaitForEndOfFrame());

            if (_animatorController.GetIntHash(_mono.PageHash) == Shipping)
            {
                yield break;
            }

            _animatorController.SetIntHash(_mono.PageHash, Shipping);

            if (target == null)
            {
                yield break;
            }
            var shipping = _mono.TransferItems(target);

            if (shipping)
            {
                _sender             = true;
                _mono.ContainerMode = ShippingContainerStates.Shipping;
            }
        }
 private void ShippingScreen(AlterraShippingTarget target)
 {
     StartCoroutine(ShippingScreenEnu(target));
 }
 internal void Initialize(AlterraShippingTarget mono)
 {
     _mono = mono;
 }