/// <summary> /// 偷资源 /// </summary> /// <param name="resource"></param> public void StolenResource(ResourceVO resource) { UnityEngine.Debug.Log("偷取:" + resource.resourceType + " " + resource.resourceCount); var found = false; foreach (var stolenResource in stolenResources) { if (stolenResource.resourceType == resource.resourceType) { stolenResource.resourceCount += resource.resourceCount; found = true; break; } } if (!found) { stolenResources.Add(resource); } //剩余被偷的资源量 AddStealableResource(new ResourceVO() { resourceType = resource.resourceType, resourceCount = -resource.resourceCount }); DataCenter.Instance.AddResource(resource, OwnerType.Attacker); EventDispather.DispatherEvent(GameEvents.STOLEN_RESOURCE, resource); }
public bool UpdateResource(ResourceVO item) { string sql = "CMG_UpdateResource"; try { using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@Product_Name", item.Product_Name); cmd.Parameters.AddWithValue("@Warehouse_ID", item.Warehouse_ID); cmd.Parameters.AddWithValue("@Product_Price", item.Product_Price); cmd.Parameters.AddWithValue("@Product_Qty", item.Product_Qty); cmd.Parameters.AddWithValue("@Product_Safety", item.Product_Safety); cmd.Parameters.AddWithValue("@Product_Category", item.Product_Category); cmd.Parameters.AddWithValue("@Company_ID", item.Company_ID); cmd.Parameters.AddWithValue("@Product_ID", item.Product_ID); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); var rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected > 0); } } catch { throw; } finally { conn.Close(); } }
private void soundSelectHandle(EventX e) { ResourceVO resourceVo = e.data as ResourceVO; SoundClip prefab = AssetDatabase.LoadAssetAtPath <SoundClip>(resourceVo.itemPath); EditorGUIUtility.PingObject(prefab); }
private void effectSelectHandle(EventX e) { ResourceVO resourceVo = e.data as ResourceVO; GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(resourceVo.itemPath); EditorGUIUtility.PingObject(prefab); if (EditorApplication.isPlaying == false) { return; } if (effectBaseObject != null) { GameObject.DestroyImmediate(effectBaseObject.gameObject); } GameObject go = new GameObject(resourceVo.fileName); effectBaseObject = go.AddComponent <BaseObject>(); effectBaseObject.transform.SetParent(BaseApp.EffectContainer.transform); effectBaseObject.rotationY = rotationY; GameObject _skin = GameObject.Instantiate(prefab); _skin.transform.localPosition = Vector3.zero; effectBaseObject.skin = _skin; effectBaseObject.fireReadyEvent(); Selection.activeGameObject = go; }
private void UpdateInfo(ResourceVO item) { code = item.Product_ID; txtResourceName.Text = item.Product_Name; txtResourceMoney.Text = item.Product_Price.ToString(); numResourceNum.Value = item.Product_Qty; numSafety.Value = item.Product_Safety; wID = item.Warehouse_ID; category = item.Product_Category; cID = item.Company_ID; }
protected AssetResource routerResourceDelegate(string url, string uri, string prefix) { string fileName = Path.GetFileNameWithoutExtension(uri); ResourceVO resourceVO = DataSource.GetResourceVO(prefix, fileName); AssetResource resource = null; if (resourceVO != null) { resource = AssetsManager.getResource(resourceVO.itemPath, LoaderXDataType.EDITORRESOURCE); } return(resource); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < dgvResource.Rows.Count && e.RowIndex > -1) { item = new ResourceVO { Product_ID = dgvResource.Rows[e.RowIndex].Cells[0].Value.ToString(), Product_Name = dgvResource.Rows[e.RowIndex].Cells[1].Value.ToString(), Product_Price = Convert.ToInt32(dgvResource.Rows[e.RowIndex].Cells[3].Value.ToString().Replace(",", "").Replace("원", "")), Product_Qty = Convert.ToInt32(dgvResource.Rows[e.RowIndex].Cells[4].Value.ToString()), Product_Safety = Convert.ToInt32(dgvResource.Rows[e.RowIndex].Cells[5].Value.ToString()), Company_ID = Convert.ToInt32(dgvResource.Rows[e.RowIndex].Cells[7].Value), Product_Category = dgvResource.Rows[e.RowIndex].Cells[8].Value.ToString(), Warehouse_ID = Convert.ToInt32(dgvResource.Rows[e.RowIndex].Cells[9].Value) }; } }
public ResourceInsUp(EditMode editMode, ResourceVO item) { InitializeComponent(); if (editMode == EditMode.Update) { lblName.Text = "자재 수정"; mode = "Update"; pbxTitle.Image = Resources.Edit_32x32; UpdateInfo(item); } else { lblName.Text = "자재 등록"; mode = "Insert"; pbxTitle.Image = Resources.AddFile_32x32; } }
public void init(string editorPrefabPath, params string[] types) { dataList.Clear(); key = ""; foreach (string type in types) { key += type + "_"; string prefabPath = editorPrefabPath + "/" + type + "/"; string[] exportKeys = EditorConfigUtils.GetPrefabExports(type); if (exportKeys == null || exportKeys.Length < 1) { exportKeys = new[] { prefabPath }; } List <string> nameList = new List <string>(); foreach (string exportPrefabPath in exportKeys) { List <string> list = FileHelper.FindFile(exportPrefabPath, exNameArr, searchOption); for (int i = 0; i < list.Count; i++) { string itemPath = list[i]; itemPath = itemPath.Replace(Application.dataPath, "Assets"); ResourceVO item = new ResourceVO(); item.itemPath = itemPath; item.fileFullName = Path.GetFileName(itemPath); string fileName = Path.GetFileNameWithoutExtension(item.fileFullName); item.fileName = fileName; item.typeKey = type; nameList.Add(fileName); dataList.Add(item); } } DataSource.Add(type, dataList); DataSource.Add(type, nameList); } pageList.dataProvider = dataList; }
/// <summary> /// 增加可以被偷的资源量 /// </summary> /// <param name="addResource"></param> private void AddStealableResource(ResourceVO addResource) { bool found = false; foreach (var resourceVo in stealableResources) { if (resourceVo.resourceType == addResource.resourceType) { found = true; resourceVo.resourceCount += addResource.resourceCount; if (resourceVo.resourceCount < 0) { resourceVo.resourceCount = 0; } break; } } if (!found) { stealableResources.Add(addResource); } }
private void InsertResource() { ResourceVO item = new ResourceVO { Product_Name = txtResourceName.Text, Warehouse_ID = Convert.ToInt32(cboResourceWarehouse.SelectedValue), Product_Price = Convert.ToInt32(txtResourceMoney.Text), Product_Qty = Convert.ToInt32(numResourceNum.Value), Product_Safety = Convert.ToInt32(numSafety.Value), Product_Category = cboResourceCategory.SelectedValue.ToString(), Company_ID = Convert.ToInt32(cboCompany.SelectedValue) }; try { StandardService service = new StandardService(); service.InsertResource(item); } catch (Exception err) { Log.WriteError(err.Message, err); } }
public override ReqWrapper Execute() { var gold = new ResourceVO() { resourceType = ResourceType.Gold, resourceCount = battleResult.rewardGoldByCrownLevel }; var oil = new ResourceVO() { resourceType = ResourceType.Oil, resourceCount = battleResult.rewardOilByCrownLevel }; DataCenter.Instance.AddResource(gold, OwnerType.Attacker); DataCenter.Instance.AddResource(oil, OwnerType.Attacker); EventDispather.DispatherEvent(GameEvents.STOLEN_RESOURCE, gold); EventDispather.DispatherEvent(GameEvents.STOLEN_RESOURCE, oil); DataCenter.Instance.AddCrown(battleResult.rewardCrown, OwnerType.Attacker); for (int i = DataCenter.Instance.Attacker.armies.Count - 1; i >= 0; i--) { if (DataCenter.Instance.Attacker.armies[i].amount == 0) { DataCenter.Instance.Attacker.armies.RemoveAt(i); } } return(new ReqWrapper() { requestType = ReqWrapper.RequestType.BattleResult, battleResultReq = new BattleResultReq() { battleResultVO = battleResult, battleReplayVO = battleReplay } }); }
/// <summary> /// 获得或者使用资源 /// </summary> /// <param name="resource"></param> public void AddResource(ResourceVO addResource, OwnerType owner = OwnerType.Defender) { AddResource(addResource.resourceType, addResource.resourceCount, owner); }
private void modelSelectHandle(EventX e) { _selectResourceVo = e.data as ResourceVO; if (_selectResourceVo == null) { return; } modelSelectedIndex = modelWindow.selectedIndex; GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(_selectResourceVo.itemPath); EditorGUIUtility.PingObject(prefab); if (EditorApplication.isPlayingOrWillChangePlaymode == false) { EditorApplication.isPlaying = true; return; } if (modelBaseObject != null && modelBaseObject.gameObject != null) { GameObject.DestroyImmediate(modelBaseObject.gameObject); modelBaseObject = null; } GameObject container = BaseApp.ActorContainer; if (container == null) { return; } int len = container.transform.childCount; for (int i = len - 1; i > -1; i--) { Transform t = container.transform.GetChild(i); DestroyImmediate(t.gameObject); } GameObject go = new GameObject(_selectResourceVo.fileName); modelBaseObject = go.AddComponent <BaseObject>(); modelBaseObject.transform.SetParent(BaseApp.ActorContainer.transform); modelBaseObject.rotationY = rotationY; modelBaseObject.position = bornPosition; if (prefab == null) { return; } GameObject skin = GameObject.Instantiate(prefab); skin.transform.localPosition = Vector3.zero; skin.transform.localRotation = Quaternion.identity; modelBaseObject.skin = skin; modelBaseObject.fireReadyEvent(); Animator _animator = modelBaseObject.getAnimator(); HashSet <string> animationName = new HashSet <string>(); List <string> animationParmsName = new List <string>(); if (_animator != null) { AnimatorOverrideController runtimeAnimatorController = _animator.runtimeAnimatorController as AnimatorOverrideController; if (runtimeAnimatorController) { List <KeyValuePair <AnimationClip, AnimationClip> > lst = new List <KeyValuePair <AnimationClip, AnimationClip> >(); runtimeAnimatorController.GetOverrides(lst); foreach (KeyValuePair <AnimationClip, AnimationClip> item in lst) { if (item.Key == null) { continue; } animationName.Add(item.Key.name); } } foreach (AnimatorControllerParameter animatorParameter in _animator.parameters) { animationParmsName.Add(animatorParameter.name); } } DataSource.Add(DataSource.ANIMATION, animationName.ToList(), true); DataSource.Add(DataSource.ANIMATION_PARMS, animationParmsName, true); List <string> boneNames = new List <string>(); SkinnedMeshRenderer[] skinnedMeshRenderers = skin.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer skinnedMeshRenderer in skinnedMeshRenderers) { foreach (Transform bone in skinnedMeshRenderer.bones) { boneNames.Add(bone.name); } } DataSource.Add(DataSource.BONE, boneNames, true); Selection.activeGameObject = go; if (BaseApp.cameraController != null) { BaseApp.cameraController.setFollow(modelBaseObject); } if (string.IsNullOrEmpty(autoMononTypeName) == false) { Type type = foundation.ObjectFactory.Locate(autoMononTypeName); if (type == null) { type = typeof(AnimatorControlerApp); } Component b = go.GetComponentInChildren(type); if (b == null) { b = go.AddComponent(type); } } timeWindow.selectedbaseObject = modelBaseObject; timeWindow.searchSkillListBy(_selectResourceVo.fileName); }
private void GetLimitsDataForSelectedUserInStore() { selectedUserLimits = new List <LimitsVO>(); //Get the limits of the selected user selectedUserLimits = SecurityProfileProcedures.GetListOfLimits(_UserVO, _ShopID); //check if all the resources which belong to the selected user has //associated limit and if yes check if its there in selecteduserlimits //and if not get the limit from the business rule List <ServiceOffering> serviceOfferings = GlobalDataAccessor.Instance.DesktopSession.ServiceOfferings; foreach (ResourceVO rVo in _UserVO.UserResources) { ResourceVO vo = rVo; if (vo.Assigned == "N") { continue; } var sOffering = (from servOffering in serviceOfferings where servOffering.ServiceOfferingID == vo.ResourceID select servOffering).FirstOrDefault(); if (sOffering.ServiceOfferingID != null) { //Check if that limit is there in selecteduserlimits var limitData = (from limit in loggedinUserLimits where limit.ServiceOffering == sOffering.ServiceOfferingID select limit).FirstOrDefault(); if (limitData == null) { LimitsVO newLimit = new LimitsVO(); newLimit.ServiceOffering = sOffering.ServiceOfferingID; newLimit.ProdOfferingId = sOffering.ProdOffering; newLimit.ResourceName = vo.ResourceName; newLimit.RoleLimitId = 0; newLimit.StoreID = string.Empty; if (vo.ResourceName == Commons.GetResourceName("NEWPAWNLOAN")) { //Get the limit from business rule decimal maxLoanLimit = 0.0m; if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetMaxLoanLimit(GlobalDataAccessor.Instance.CurrentSiteId, out maxLoanLimit)) { newLimit.Limit = maxLoanLimit; } } if (vo.ResourceName == Commons.GetResourceName("CUSTOMERBUY")) { //Set the limit to the max newLimit.Limit = 99999; } selectedUserLimits.Add(newLimit); } } } this.gvLimits.AutoGenerateColumns = false; foreach (LimitsVO limitData in selectedUserLimits) { if (limitData.StoreNumber == string.Empty) { //If the limit being shown is the default limit //Make sure the corresponding resource is still part //of the user's resources list var resName = (from resource in selectedUserResources where resource == limitData.ResourceName select resource).FirstOrDefault(); if (resName == null) { continue; } } DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell1 = new DataGridViewTextBoxCell(); cell1.Value = limitData.ProdOfferingId.ToString(); dgvr.Cells.Insert(0, cell1); DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell(); cell2.Value = limitData.ResourceName.ToString(); dgvr.Cells.Insert(1, cell2); DataGridViewTextBoxCell cell3 = new DataGridViewTextBoxCell(); cell3.Value = limitData.Limit; dgvr.Cells.Insert(2, cell3); DataGridViewTextBoxCell cell4 = new DataGridViewTextBoxCell(); cell4.Value = limitData.RoleLimitId; dgvr.Cells.Insert(3, cell4); gvLimits.Rows.Add(dgvr); } //Set the format for the limit field to currency //TO DO - when limit type attribute is added the format will change accordingly gvLimits.Columns[2].DefaultCellStyle.Format = "C"; populateLimitsDataGrid(); }
private void SecurityProfile_Load(object sender, EventArgs e) { try { this.NavControlBox.Owner = this; limitsErrorLabel.Text = ""; resourcesErrorLabel.Text = ""; addedResource = new List <string>(); removedResource = new List <string>(); errorMessages = new StringBuilder(); isFormValid = true; _UserVO = GlobalDataAccessor.Instance.DesktopSession.SelectedUserProfile; employeeNumberLabel.Text = !string.IsNullOrEmpty(_UserVO.EmployeeNumber) ? _UserVO.EmployeeNumber : ""; employeeRoleLabel.Text = _UserVO.UserFirstName + " " + _UserVO.UserLastName + " " + _UserVO.UserRole.RoleName; homeShopIDLabel.Text = _UserVO.FacNumber ?? ""; limitsLastUpdated.Text = _UserVO.LastUpdatedDate.ToShortDateString(); _userStores = _UserVO.ProfileStores; _ShopID = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; if (_userStores.Count > 0 && _userStores[0] != null) { foreach (string s in _userStores) { shopIDComboBox.Items.Add(s); } } //TODO: Fix THIS!!!! Should be a static method call!!!!!!!!! new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetMaxLoanLimit(CashlinxDesktopSession.Instance.CurrentSiteId, out maxLoanStateLimit); loggedInUser = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile; loggedinUserLimits = new List <LimitsVO>(); //Populate the limits list //Get the limits of the logged in user loggedinUserLimits = SecurityProfileProcedures.GetListOfLimits(loggedInUser, _ShopID); List <ServiceOffering> serviceOfferings = GlobalDataAccessor.Instance.DesktopSession.ServiceOfferings; foreach (ResourceVO rVo in loggedInUser.UserResources) { ResourceVO vo = rVo; var sOffering = (from servOffering in serviceOfferings where servOffering.ServiceOfferingID == vo.ResourceID select servOffering).FirstOrDefault(); if (sOffering.ServiceOfferingID != null) { //Check if that limit is there in loggedinuserlimits var limitData = (from limit in loggedinUserLimits where limit.ServiceOffering == sOffering.ServiceOfferingID select limit).FirstOrDefault(); if (limitData == null) { LimitsVO newLimit = new LimitsVO(); newLimit.ServiceOffering = sOffering.ServiceOfferingID; newLimit.ProdOfferingId = sOffering.ProdOffering; newLimit.ResourceName = vo.ResourceName; newLimit.RoleLimitId = 0; newLimit.StoreID = string.Empty; if (vo.ResourceName == Commons.GetResourceName("NEWPAWNLOAN")) { //Get the limit from business rule decimal maxLoanLimit = 0.0m; if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetMaxLoanLimit(GlobalDataAccessor.Instance.CurrentSiteId, out maxLoanLimit)) { newLimit.Limit = maxLoanLimit; } } if (vo.ResourceName == Commons.GetResourceName("CUSTOMERBUY")) { //Set the limit to the max newLimit.Limit = 99999; } loggedinUserLimits.Add(newLimit); } } } shopIDComboBox.SelectedIndex = _userStores.IndexOf(_ShopID); } catch (Exception ex) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot load security profile"); BasicExceptionHandler.Instance.AddException("Security profile could not be loaded " + ex.Message, new ApplicationException(ex.ToString())); } }
public bool UpdateResource(ResourceVO item) { ResourceDAC dac = new ResourceDAC(); return(dac.UpdateResource(item)); }
public bool InsertResource(ResourceVO item) { ResourceDAC dac = new ResourceDAC(); return(dac.InsertResource(item)); }
public void RequestBuyResource(ResourceVO resVO) { new BuyResourceCommand(resVO).ExecuteAndSend(); }
public BuyResourceCommand(ResourceVO resourceVO) { this.resourceVO = resourceVO; }
private bool buildAssetBundle(Object mainAsset,Object[] assets) { bool buildSuccess = false; //string sourcePath = AssetDatabase.GetAssetPath (mainAsset); //本地测试:建议最后将Assetbundle放在StreamingAssets文件夹下,如果没有就创建一个,因为移动平台下只能读取这个路径 //StreamingAssets是只读路径,不能写入 //服务器下载:就不需要放在这里,服务器上客户端用www类进行下载。 string targetPath; string assetName; int i,len; // 自动生成资源配置文件 AssetBundleConfig cfg = ScriptableObject.CreateInstance<AssetBundleConfig>(); ResourceVO vo; List<Object> outList = new List<Object> (); // 首先检测是否存在StreamingAssets文件夹 // 打包单个 if (mainAsset != null) { targetPath = Application.dataPath + "/StreamingAssets/" + mainAsset.name + ".assetbundle"; assetName = mainAsset.name; vo = new ResourceVO(); vo.resId = mainAsset.name; cfg.resourceVOs.Add(vo); outList.Add(mainAsset); } // 打包全部 else { targetPath = Application.dataPath + "/StreamingAssets/" + assets[0].name + ".assetbundle"; assetName = "所有"; len = assets.Length; for (i=0;i<len;i++) { vo = new ResourceVO(); vo.resId = assets[i].name; cfg.resourceVOs.Add(vo); outList.Add(assets[i]); } } outList.Add(this.saveAsObj(cfg)); mainAsset = null; if (this._usePlatform == this.PlatformPC) { buildSuccess = BuildPipeline.BuildAssetBundle (null, outList.ToArray(), targetPath, BuildAssetBundleOptions.CollectDependencies); } else if (this._usePlatform == this.PlatformAndroid) { buildSuccess = BuildPipeline.BuildAssetBundle (null, outList.ToArray(), targetPath, BuildAssetBundleOptions.CollectDependencies,BuildTarget.Android); } else if (this._usePlatform == this.PlatformIPhone) { buildSuccess = BuildPipeline.BuildAssetBundle (null, outList.ToArray(), targetPath, BuildAssetBundleOptions.CollectDependencies,BuildTarget.iOS); } if ( buildSuccess ) { Debug.Log (assetName + "资源打包成功"); } else { Debug.Log(assetName +"资源打包失败"); } this.deleteTempCfgFile (); return buildSuccess; }