protected override void OnAwake(PlayerActor player) { player.SetActiveOnEquipedItem(false); player.ChaControl.setAllLayerWeight(0.0f); this.isEnd = false; this.isWait = (Func <PlayerActor, bool>)null; this.isNextEnabled = false; if (this.disposable != null) { this.disposable.Clear(); } this.disposable = new CompositeDisposable(); if (Object.op_Equality((Object)(this.hasAnimal = player.Animal), (Object)null)) { this.isEnd = true; this.ToErrorEnd(player); } else { this.animalName = this.hasAnimal.Name; this.isCameraBlend = true; this.getPercent = 30f; if (this.hasAnimal is WildGround) { this.getPercent = (this.hasAnimal as WildGround).GetPercent; } this.getAnimalFlag = (double)Random.Range(0.0f, 100f) <= (double)this.getPercent; if (this.getAnimalFlag && Singleton <Resources> .IsInstance() && Singleton <Manager.Map> .IsInstance()) { List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList; if (itemList != null) { this.getIteminfo = this.hasAnimal.ItemInfo; if (this.getIteminfo != null) { this.addItem = new StuffItem(this.getIteminfo.CategoryID, this.getIteminfo.ID, 1); itemList.AddItem(this.addItem); } } } if (Singleton <Manager.Map> .IsInstance()) { List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList; if (itemList != null && this.hasAnimal is WildGround) { ItemIDKeyPair getItemId = (this.hasAnimal as WildGround).GetItemID; itemList.RemoveItem(new StuffItem(getItemId.categoryID, getItemId.itemID, 1)); } } MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None); if (this.hasAnimal.AnimalType == AnimalTypes.Cat || this.hasAnimal.AnimalType == AnimalTypes.Chicken) { this.Initialize(player); } else { this.ToErrorEnd(player); } } }
private ValueTuple <AIProject.SaveData.AnimalData, PetChicken> CreateChicken( AIProject.SaveData.Environment.ChickenInfo info) { ValueTuple <AIProject.SaveData.AnimalData, PetChicken> valueTuple; ((ValueTuple <AIProject.SaveData.AnimalData, PetChicken>) ref valueTuple).\u002Ector((AIProject.SaveData.AnimalData)null, (PetChicken)null); if (info == null || !Singleton <AnimalManager> .IsInstance() || Object.op_Equality((Object)this._currentFarmPoint, (Object)null)) { return(valueTuple); } int _animalTypeID = 1; AnimalBase animalBase = Singleton <AnimalManager> .Instance.CreateBase(_animalTypeID, 1); IPetAnimal petAnimal = animalBase as IPetAnimal; if (Object.op_Equality((Object)animalBase, (Object)null)) { return(valueTuple); } ((Component)animalBase).get_transform().SetParent(this._currentFarmPoint.AnimalRoot, true); AIProject.SaveData.AnimalData animalData = new AIProject.SaveData.AnimalData(); animalData.AnimalID = animalBase.AnimalID; animalData.RegisterID = this._currentFarmPoint.RegisterID; animalData.AnimalType = AnimalTypes.Chicken; animalData.AnimalTypeID = _animalTypeID; animalData.InitAnimalTypeID = true; animalData.BreedingType = BreedingTypes.Pet; animalData.Nickname = info.name; ItemIDKeyPair itemId = animalBase.ItemID; animalData.ItemCategoryID = itemId.categoryID; animalData.ItemID = itemId.itemID; if (petAnimal != null) { petAnimal.AnimalData = animalData; if (animalBase is PetChicken) { (animalBase as PetChicken).Initialize(this._currentFarmPoint); } } valueTuple.Item1 = (__Null)animalData; valueTuple.Item2 = (__Null)(animalBase as PetChicken); return(valueTuple); }
private void EndState(PlayerActor player) { StuffItem equipedLampItem = player.PlayerData.EquipedLampItem; ItemIDKeyPair torchId = Singleton <Resources> .Instance.CommonDefine.ItemIDDefine.TorchID; ItemIDKeyPair maleLampId = Singleton <Resources> .Instance.CommonDefine.ItemIDDefine.MaleLampID; ItemIDKeyPair flashlightId = Singleton <Resources> .Instance.CommonDefine.ItemIDDefine.FlashlightID; if (equipedLampItem.CategoryID == torchId.categoryID && equipedLampItem.ID == torchId.itemID || equipedLampItem.CategoryID == maleLampId.categoryID && equipedLampItem.ID == maleLampId.itemID || equipedLampItem.CategoryID == flashlightId.categoryID && equipedLampItem.ID == flashlightId.itemID) { player.CameraControl.CrossFade.FadeStart(-1f); } if (player.PlayerController.PrevStateName == "Onbu") { player.PlayerController.ChangeState("Onbu"); } else { player.PlayerController.ChangeState("Normal"); } }
private void LoadLocomotionAnimation( PlayerActor player, out PlayState info, ref EquipEventItemInfo itemInfo) { Resources instance = Singleton <Resources> .Instance; LocomotionProfile locomotionProfile = instance.LocomotionProfile; PlayerProfile playerProfile = instance.PlayerProfile; StuffItem equipedLampItem = player.PlayerData.EquipedLampItem; CommonDefine.ItemIDDefines itemIdDefine = instance.CommonDefine.ItemIDDefine; if (equipedLampItem != null) { ItemIDKeyPair torchId = itemIdDefine.TorchID; ItemIDKeyPair flashlightId = itemIdDefine.FlashlightID; ItemIDKeyPair maleLampId = itemIdDefine.MaleLampID; if (equipedLampItem.CategoryID == torchId.categoryID && equipedLampItem.ID == torchId.itemID) { info = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.TorchOnbuLocoID]; itemInfo = instance.GameInfo.CommonEquipEventItemTable[torchId.categoryID][torchId.itemID]; itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName; return; } if (equipedLampItem.CategoryID == maleLampId.categoryID && equipedLampItem.ID == maleLampId.itemID) { info = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.LampOnbuLocoID]; itemInfo = instance.GameInfo.CommonEquipEventItemTable[maleLampId.categoryID][maleLampId.itemID]; itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName; return; } if (equipedLampItem.CategoryID == flashlightId.categoryID && equipedLampItem.ID == flashlightId.itemID) { info = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.TorchOnbuLocoID]; itemInfo = instance.GameInfo.CommonEquipEventItemTable[flashlightId.categoryID][flashlightId.itemID]; itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName; return; } } info = (PlayState)null; }
private void SettingInventoryFilter() { Manager.Resources resources = !Singleton <Manager.Resources> .IsInstance() ? (Manager.Resources)null : Singleton <Manager.Resources> .Instance; PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player; if (Object.op_Equality((Object)resources, (Object)null) || Object.op_Equality((Object)playerActor, (Object)null)) { return; } PetHomePoint.HomeKind kind = this._currentPetHomePoint.Kind; Dictionary <int, List <ValueTuple <ItemIDKeyPair, int> > > petItemInfoTable = resources.AnimalTable.PetItemInfoTable; int key = (int)kind; InventoryFacadeViewer.ItemFilter[] itemFilter1 = (InventoryFacadeViewer.ItemFilter[])null; if (!this._itemFilterTable.TryGetValue(key, out itemFilter1)) { List <ValueTuple <ItemIDKeyPair, int> > valueTupleList; petItemInfoTable.TryGetValue(key, out valueTupleList); if (!((IReadOnlyList <ValueTuple <ItemIDKeyPair, int> >)valueTupleList).IsNullOrEmpty <ValueTuple <ItemIDKeyPair, int> >()) { Dictionary <int, List <int> > toRelease = DictionaryPool <int, List <int> > .Get(); using (List <ValueTuple <ItemIDKeyPair, int> > .Enumerator enumerator = valueTupleList.GetEnumerator()) { while (enumerator.MoveNext()) { ItemIDKeyPair itemIdKeyPair = (ItemIDKeyPair)enumerator.Current.Item1; List <int> intList1; if (!toRelease.TryGetValue(itemIdKeyPair.categoryID, out intList1) || intList1 == null) { List <int> intList2 = ListPool <int> .Get(); toRelease[itemIdKeyPair.categoryID] = intList2; intList1 = intList2; } intList1.Add(itemIdKeyPair.itemID); } } InventoryFacadeViewer.ItemFilter[] itemFilter2 = new InventoryFacadeViewer.ItemFilter[toRelease.Count]; int index1 = 0; foreach (KeyValuePair <int, List <int> > keyValuePair in toRelease) { int[] IDs = new int[keyValuePair.Value.Count]; for (int index2 = 0; index2 < IDs.Length; ++index2) { IDs[index2] = keyValuePair.Value[index2]; } itemFilter2[index1] = new InventoryFacadeViewer.ItemFilter(keyValuePair.Key, IDs); ++index1; } List <int> list = toRelease.Keys.ToList <int>(); for (int index2 = 0; index2 < list.Count; ++index2) { ListPool <int> .Release(toRelease[list[index2]]); } DictionaryPool <int, List <int> > .Release(toRelease); this._itemFilterTable[key] = itemFilter2; this._inventoryUI.SetItemFilter(itemFilter2); } else { this._itemFilterTable[key] = this._emptyFilter; this._inventoryUI.SetItemFilter(this._emptyFilter); } } else { this._inventoryUI.SetItemFilter(itemFilter1); } }
public bool MatchItem(ItemIDKeyPair key) { return(this.CategoryID == key.categoryID && this.ID == key.itemID); }