private void OnDestroy() { if (!AppMain.isApplicationQuit && instance == this) { instance = null; } }
public int ProgressDelivery(int delivery_id, int need_index, int add_num) { DeliveryTable.DeliveryData deliveryTableData = Singleton <DeliveryTable> .I.GetDeliveryTableData((uint)delivery_id); ClearStatusDelivery clearStatusDelivery = this.clearStatusDelivery.Find((ClearStatusDelivery data) => data.deliveryId == delivery_id); if (clearStatusDelivery == null) { clearStatusDelivery = new ClearStatusDelivery(); clearStatusDelivery.deliveryId = delivery_id; if (deliveryTableData != null) { int i = 0; for (int num = deliveryTableData.needs.Length; i < num; i++) { clearStatusDelivery.needCount.Add(0); } } this.clearStatusDelivery.Add(clearStatusDelivery); } int num2 = clearStatusDelivery.needCount[need_index]; List <int> needCount; List <int> list = needCount = clearStatusDelivery.needCount; int index; int index2 = index = need_index; index = needCount[index]; list[index2] = index + add_num; if (clearStatusDelivery.needCount[need_index] > (int)deliveryTableData.needs[need_index].needNum) { clearStatusDelivery.needCount[need_index] = (int)deliveryTableData.needs[need_index].needNum; add_num = clearStatusDelivery.needCount[need_index] - num2; } if (IsClearTutorialDelivery(deliveryTableData, clearStatusDelivery) && UITutorialFieldHelper.IsValid()) { UITutorialFieldHelper.I.OnCollectItem(); } return(add_num); }
private void Awake() { instance = this; }