IEnumerator InitializeMain(int level) { loadingScreen.alpha = 1; var p = Application.LoadLevelAsync(level); while (!p.isDone) { yield return(null); } var timme = 2f; while (timme > 0) { timme -= Time.deltaTime; BAR.value = 1 - timme / 2; yield return(null); } _timerLabel.enabled = true; StartCoroutine(StartTimer()); state = true; Inventory.AddItems(levelInfo.GetInfoLevel(Application.loadedLevel)._Items); loadingScreen.alpha = 0; }
private void BTN_InventoryItem_Add_Click(object sender, EventArgs e) { if (CMB_ItemType.SelectedItem == null) { return; } if (Amount <= 0.0f) { return; } try { SandboxGameAssemblyWrapper.Instance.GameAction(() => { var amount = (MyFixedPoint)Amount; var content = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(SelectedType); MyObjectBuilder_InventoryItem inventoryItem = new MyObjectBuilder_InventoryItem { Amount = amount, Content = content }; if (InventoryContainer.CanItemsBeAdded(amount, SelectedType)) { InventoryContainer.AddItems(amount, inventoryItem.Content); } }); Close(); } catch (Exception ex) { ApplicationLog.BaseLog.Error(ex); } }