public void CheckBuildShip()
 {
     if (GlobalLock.instance.CanGo)
     {
         GlobalLock.instance.GoNow();
     }
     else
     {
         return;
     }
     SelectMaterialpArgs args = new SelectMaterialpArgs(this.oilInput.currentValue, this.steelInput.currentValue, this.ammoInput.currentValue, this.alumniumInput.currentValue);
     if (this.IsItemEnouth && this.IsResourceEnough(args))
     {
         if (this.itemIndex == ResourceTypes.BuildShipItem)
         {
             lastOilInput = this.oilInput.currentValue;
             lastSteelInput = this.steelInput.currentValue;
             lastAmmoInput = this.ammoInput.currentValue;
             lastAluminumInput = this.alumniumInput.currentValue;
         }
         if (this.itemIndex == ResourceTypes.BuildEquipItem)
         {
             lastOilInput2 = this.oilInput.currentValue;
             lastSteelInput2 = this.steelInput.currentValue;
             lastAmmoInput2 = this.ammoInput.currentValue;
             lastAluminumInput2 = this.alumniumInput.currentValue;
         }
         this.OnStartBuildShip(args);
         this.HideThis();
     }
     else
     {
         OptionPanel panel;
         if (!this.IsItemEnouth)
         {
             panel = UIManager.instance.ShowNeedBuyItem(this.itemIndex);
         }
         else
         {
             panel = UIManager.instance.ShowNeedBuyItem(this.notEnoughResources[0]);
         }
         panel.Confirm += new EventHandler<EventArgs>(this.OnGotoShopBuyItem);
     }
 }
 private void StartBuildShip(object o, SelectMaterialpArgs e)
 {
     this.showActionGO.SetActive(true);
     this.showActionGO.GetComponent<AnimatePosition>().StartMove();
     if ((e != null) && !this.isRequestingServer)
     {
         this.isRequestingServer = true;
         TutorialManager.instance.CheckStepFinishAction("FactoryConfirmBuildClick");
         this.buildingArgs = e;
         this.buildShipInDock = ServerRequestManager.instance.BuildShipInDock(this.selectedDockIndex, e.oil, e.steel, e.ammo, e.aluminium);
         this.buildShipInDock.BuildShipSuccess += new EventHandler<EventArgs>(this.OnStartBuildShipSuccess);
         this.buildShipInDock.BuildShipFail += new EventHandler<EventArgs>(this.OnStartBuildShipFail);
     }
 }
 protected virtual void OnStartBuildShip(SelectMaterialpArgs e)
 {
     if (this.StartBuildShip != null)
     {
         this.StartBuildShip(this, e);
     }
 }
 private bool IsResourceEnough(SelectMaterialpArgs args)
 {
     this.notEnoughResources = new List<ResourceTypes>();
     if (this.userInfo.oil < args.oil)
     {
         this.notEnoughResources.Add(ResourceTypes.Oil);
     }
     if (this.userInfo.ammo < args.ammo)
     {
         this.notEnoughResources.Add(ResourceTypes.Ammo);
     }
     if (this.userInfo.steel < args.steel)
     {
         this.notEnoughResources.Add(ResourceTypes.Steel);
     }
     if (this.userInfo.aluminium < args.aluminium)
     {
         this.notEnoughResources.Add(ResourceTypes.Aluminium);
     }
     return (this.notEnoughResources.Count == 0);
 }