protected virtual void Collect(BuildingIdentity id, ResourceType type, CollectMethod collectMethod = CollectMethod.Button) { if (SceneManager.Instance.SceneMode == SceneMode.SceneVisit || this.m_CurrentState != BuildingEditorState.Normal || !this.BuildingBehavior.CheckBuildingCreateStack()) { return; } if (this.m_CurrentState == BuildingEditorState.Normal) { switch (collectMethod) { case CollectMethod.Building: if (SystemFunction.CheckCollectValidity(this.BuildingLogicData, type) > 0) { SceneManager.Instance.CreateCollectFX(this.BuildingBehavior, type, LogicController.Instance.Collect(id, type), this.BuildingLogicData); } //this.CreateCollectFX(type, LogicController.Instance.Collect(id, type)); break; case CollectMethod.Button: if (SystemFunction.CheckCollectValidityByButton(this.BuildingLogicData, type)) { SceneManager.Instance.CreateCollectFX(this.BuildingBehavior, type, LogicController.Instance.Collect(id, type), this.BuildingLogicData); } //this.CreateCollectFX(type, LogicController.Instance.Collect(id, type)); break; } } }
void CollectIconSate(Action <int> action) { switch (this.BuildingLogicData.BuildingIdentity.buildingType) { case BuildingType.GoldMine: m_ResourceIcon.spriteId = m_ResourceIcon.GetSpriteIdByName(ClientSystemConstants.SCENE_RESOURCE_ICON_DICTIONARY[ResourceType.Gold]); if (this.BuildingLogicData.CurrentBuilidngState != BuildingEditorState.Normal || this.BuildingBehavior.IsClick) { action.Invoke(0); } else { action.Invoke(SystemFunction.CheckCollectValidity(this.BuildingLogicData, ResourceType.Gold)); } break; case BuildingType.Farm: m_ResourceIcon.spriteId = m_ResourceIcon.GetSpriteIdByName(ClientSystemConstants.SCENE_RESOURCE_ICON_DICTIONARY[ResourceType.Food]); if (this.BuildingLogicData.CurrentBuilidngState != BuildingEditorState.Normal || this.BuildingBehavior.IsClick) { action.Invoke(0); } else { action.Invoke(SystemFunction.CheckCollectValidity(this.BuildingLogicData, ResourceType.Food)); } break; } //if (this.BuildingLogicData.BuildingType == BuildingType.Farm) //{ // print("name =" + this.BuildingLogicData.Name); // print("prefabName = " + this.gameObject); // print("BuildingLogicData.CurrentStoreFood =" + BuildingLogicData.CurrentStoreFood); //} }