private void InitObj(ObjItem item) { item.transform.position = spanPos.position; item.onRoad = true; item.Reset(); item.gameObject.SetActive(true); }
public ObjItem _uiitem_generate(ObjItem _uiitem, PARENT_PANEL _parent, Items _item = null) { ObjItem _ptr = null; if (_uiitem == null) { _ptr = generateitem(_item); } else { _ptr = _uiitem; } switch (_parent) { case PARENT_PANEL.INVENTORY: _ptr.transform.SetParent(GameResources.Instance()._InventoryPanel); _ptr.setsize(GameResources._v2_70); break; case PARENT_PANEL.EQSOLT: _ptr.transform.SetParent(GameResources.Instance()._EquipSolt[_ptr._Items._PartId]); _ptr.setsize(GameResources._v2_64); break; case PARENT_PANEL.SKILL: _ptr.transform.SetParent(GameResources.Instance()._SkillPanel); _ptr.setsize(GameResources._v2_100); break; default: break; } return(_ptr); }
private void CreateSeatItems() { try { mListSeatItems.Clear(); for (int i = 0; i < mListSeatInfos.Count; i++) { SeatInfo seatInfo = mListSeatInfos[i]; ObjItem item = new ObjItem(); item.Data = seatInfo; item.ObjType = S4410Consts.RESOURCE_SEAT; item.ObjID = seatInfo.ObjID; item.Name = seatInfo.Name; item.State = seatInfo.State; item.Level = seatInfo.Level; item.Extension = seatInfo.Extension; item.Description = seatInfo.Description; item.StrState = CurrentApp.GetLanguageInfo(string.Format("4413010{0}", seatInfo.State.ToString("000")), seatInfo.State.ToString()); item.StrLevel = item.Level.ToString(); mListSeatItems.Add(item); } } catch (Exception ex) { ShowException(ex.Message); } }
private string GetItemIcon(ObjItem item) { string strReturn = string.Empty; try { var regionInfo = item.Data as RegionInfo; if (regionInfo != null) { int type = regionInfo.Type; switch (type) { case 1: strReturn = string.Format("Images/00004.png"); break; case 2: strReturn = string.Format("Images/00003.png"); break; default: strReturn = string.Format("Images/00005.png"); break; } } } catch { } return(strReturn); }
private ObjItem[,,] AllDataAroundMe() { int[,] arrayMap = new int[16, 12]; ObjItem[,,] arrayObjItem = new ObjItem[16, 12, 8]; string miniMap = ""; for (int stage = 0; stage < 8; stage++) { miniMap += "stage: " + stage + "\n"; for (int i = 1; i < 12; i++) { miniMap += "["; for (int j = 1; j < 16; j++) { { OpenTibiaUnity.Core.WorldMap.Field _field = GameManager.Instance.WorldMapStorage.GetField(new Vector3Int(j, i, stage)); int countItem = _field.ObjectsNetwork.Where(c => c != null).Count(); int groundId = 0; if (_field.ObjectsNetwork[0] != null) { groundId = (int)_field.ObjectsNetwork[0].Id; } ObjItem _objItem = new ObjItem(); bool done = false; for (int e = 0; e < _field.ObjectsNetwork.Length; e++) { if (_field.ObjectsNetwork[e] != null) { if (!done) { _objItem._shouldRecalculateTRS = _field.ObjectsNetwork[0]._shouldRecalculateTRS; done = true; if (stage == 1) { _objItem._shouldRecalculateTRS = _field.ObjectsNetwork[0]._shouldRecalculateTRS; } } _objItem.items.Add((int)_field.ObjectsNetwork[e].Id); } } arrayObjItem[j - 1, i - 1, stage] = _objItem; arrayMap[j - 1, i - 1] = groundId; int value = done == false ? 0 : 1; miniMap += value + ","; } } miniMap += "]" + "\n"; } } print(miniMap); return(arrayObjItem); }
private void GetObjFace(ObjFace face, ObjItem objModel, ref List <float> vertexPositions, ref List <float> vertexNormals, ref List <float> vertexTextureCoordinates, ref List <float> vertexBoneWeights, ref List <float> vertexBoneIndices, ref List <uint> indeces) { if (face.Count == 3) { for (var i = 0; i < face.Count; i++) { var faceVertex = face[i]; ObjLoader.AppendObjTriangle(objModel, faceVertex, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); } SetFaceTriangleIndex(face, objModel); } else if (face.Count == 4) { var faceVertex0 = face[0]; var faceVertex1 = face[1]; var faceVertex2 = face[2]; var faceVertex3 = face[3]; ObjLoader.AppendObjTriangle(objModel, faceVertex0, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); ObjLoader.AppendObjTriangle(objModel, faceVertex1, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); ObjLoader.AppendObjTriangle(objModel, faceVertex2, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); ObjLoader.AppendObjTriangle(objModel, faceVertex2, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); ObjLoader.AppendObjTriangle(objModel, faceVertex3, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); ObjLoader.AppendObjTriangle(objModel, faceVertex0, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces); SetFaceTriangleIndex(face, objModel); } }
/// <summary> /// Invadd2equip the specified _item. /// </summary> /// <param name="_item">Item.</param> public void invadd2equip(ObjItem _uiitem) { Items _item = _uiitem._Items; if (_item._NCnt == 1) { _userdatabase.executequery(string.Format("DELETE FROM Inventory WHERE NId = {0} AND NCnt = {1} AND NStat = {2}", _item._NId, _item._NCnt, -1)); _uiitem._Items._NStat = _uiitem._Items._PartId; _uiitem_generate(_uiitem, PARENT_PANEL.EQSOLT); _inventory.Remove(_uiitem); } else { _userdatabase.executequery(string.Format("UPDATE Inventory SET NCnt = {0} WHERE NId = {1} AND NCnt = {2} AND NStat = {3}", _item._NCnt - 1, _item._NId, _item._NCnt, _item._NStat)); _uiitem.consume(1); ObjItem _itemrtn = _uiitem_generate(null, PARENT_PANEL.EQSOLT, _item); _itemrtn.setcnt(1); _itemrtn._Items._NStat = _uiitem._Items._PartId; } //写入装备槽 _userdatabase.executequery(string.Format("UPDATE Inventory SET NId = {0} WHERE NStat = {1}", _item._NId, _item._PartId)); }
private void GetCheckItems(ObjItem item, ref List <ObjItem> listItems) { try { if (item.IsChecked == false) { return; } if (item.IsChecked == true) { listItems.Add(item); } for (int i = 0; i < item.Children.Count; i++) { var child = item.Children[i] as ObjItem; if (child == null) { continue; } GetCheckItems(child, ref listItems); } } catch (Exception ex) { ShowException(ex.Message); } }
private void SetRegionMmt(ObjItem regionItem, List <string> listUserIDStates) { try { int count = listUserIDStates.Count; WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.SetRegionMmt; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(regionItem.ObjID.ToString()); webRequest.ListData.Add(count.ToString()); for (int i = 0; i < count; i++) { webRequest.ListData.Add(listUserIDStates[i]); } Service44101Client client = new Service44101Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("WSFail\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } CurrentApp.WriteLog("SetRegionMmt", string.Format("End.\t{0}", regionItem.ObjID)); ShowInformation(CurrentApp.GetLanguageInfo("COMN003", string.Format("Save end"))); } catch (Exception ex) { ShowException(ex.Message); } }
public ObjItem generateitem(Items _data) { GameObject _itemprefab = GameObject.Instantiate(Resources.Load("UIFrame/ObjItem", typeof(GameObject))) as GameObject; ObjItem _uiitem = _itemprefab.GetComponent <ObjItem> (); _uiitem.init(_data); return(_uiitem); }
private List <MeshPartInfo> LoadHeadMeshes(ObjItem objModel, bool fromDragAndDrop, ManType manType, float scale, ref int lastTriangle) { var result = new List <MeshPartInfo>(); var vertexPositions = new List <float>(); var vertexNormals = new List <float>(); var vertexTextureCoordinates = new List <float>(); var vertexBoneIndices = new List <float>(); var vertexBoneWeights = new List <float>(); var indeces = new List <uint>(); foreach (var modelGroup in objModel.Groups) // one group - one mesh { // if (/*!ProgramCore.PluginMode &&*/ ( modelGroup.Key.Name == "Tear" || modelGroup.Key.Name == "Cornea" || modelGroup.Key.Name == "EyeReflection")) // очень плохие материалы. ИЗ-за них ломаются глазки. // continue; // если это плагин - то пропуск материалов ВСЕ ломает для экспортера в строчке GetObjFace. Возможно потребуется химичить с индексами vertexPositions.Clear(); vertexNormals.Clear(); vertexTextureCoordinates.Clear(); vertexBoneIndices.Clear(); vertexBoneWeights.Clear(); indeces.Clear(); foreach (var face in modelGroup.Value.Faces) // combine all meshes in group - to one mesh. { GetObjFace(face, objModel, ref vertexPositions, ref vertexNormals, ref vertexTextureCoordinates, ref vertexBoneWeights, ref vertexBoneIndices, ref indeces, ref lastTriangle); } var positions = new List <Vector3>(); var texCoords = new List <Vector2>(); var index = 0; for (var i = 0; i < vertexPositions.Count / 3; ++i) { index = i * 3; positions.Add(new Vector3(vertexPositions[index], vertexPositions[index + 1], vertexPositions[index + 2])); texCoords.Add(new Vector2(vertexTextureCoordinates[i * 2], 1.0f - vertexTextureCoordinates[i * 2 + 1])); } var meshPartInfo = new MeshPartInfo { VertexPositions = GetScaledVertices(positions, scale), TextureCoords = texCoords, PartName = modelGroup.Key.Name == "default" ? string.Empty : modelGroup.Key.Name, }; meshPartInfo.Texture = modelGroup.Key.Texture; meshPartInfo.TransparentTexture = modelGroup.Key.TransparentTexture; meshPartInfo.TextureName = modelGroup.Key.DiffuseTextureMap; meshPartInfo.TransparentTextureName = modelGroup.Key.TransparentTextureMap; meshPartInfo.Color = new Vector4(modelGroup.Key.DiffuseColor.X, modelGroup.Key.DiffuseColor.Y, modelGroup.Key.DiffuseColor.Z, modelGroup.Key.Transparency); meshPartInfo.MaterialName = modelGroup.Key.Name; result.Add(meshPartInfo); } return(result); }
private void PreloadResource(ResourceLoader resLoader, ObjItem obj) { string path = $@"Map\Obj\{obj.OS}.img\{obj.L0}\{obj.L1}\{obj.L2}"; var aniItem = resLoader.LoadAnimationData(path); obj.View = new ObjItem.ItemView() { Animator = CreateAnimator(aniItem) }; }
public ObjItem getItem(ObjItem item) { ItemEntity itemEntity = ItemEntity.FillData(item); if (!itemEntity.IsCanAdd) { if (items.Count < maxItem) { items.Add(itemEntity); item.count = 0; } else { Debug.Log("GET FAIL"); } } else { if (items.Count < 1) { items.Add(itemEntity); item.count = 0; } else { foreach (ItemEntity currItem in items) { if (currItem.ObjId.Equals(itemEntity.ObjId) && currItem.Count < currItem.MaxAdd) { currItem.Count = currItem.Count + itemEntity.Count; if (currItem.Count - currItem.MaxAdd > 0) { item.count = currItem.Count - currItem.MaxAdd; itemEntity.Count = item.count; currItem.Count = currItem.MaxAdd; } else { item.count = 0; } } else { continue; } } if (item.count > 0 && items.Count < maxItem) { items.Add(itemEntity); item.count = 0; } } } return(item); }
private void SetFaceTriangleIndex(ObjFace face, ObjItem objModel) { if (objModel.ObjExport != null && face.ObjExportIndex > -1) { objModel.ObjExport.Faces[face.ObjExportIndex].TriangleIndex0 = LastTriangleIndex++; if (face.Count == 4) { objModel.ObjExport.Faces[face.ObjExportIndex].TriangleIndex1 = LastTriangleIndex++; } } }
/* * public static string getNextDJHId(string id) * { * if (id.Length != 12) * { * return null; * } * string t = id.Substring(0, 2); * id = id.Substring(2); * * long num = long.Parse(id); * string next = (num + 1) + ""; * StringBuilder sbf = new StringBuilder(); * for (int i = 0; i < (10 - next.Length); i++) * { * sbf.Append("0"); * } * sbf.Append(next); * * return t+ sbf.ToString(); * } * * public static string getNextId2(string id,int l) * { * if (id.Length <2) * { * return null; * } * string t = id.Substring(0, 2); * id = id.Substring(2); * * long num = long.Parse(id); * string next = (num + 1) + ""; * StringBuilder sbf = new StringBuilder(); * for (int i = 0; i < (l-2 - next.Length); i++) * { * sbf.Append("0"); * } * sbf.Append(next); * * return t + sbf.ToString(); * } */ /// <summary> /// 获取住院号 /// </summary> /// <param name="dao"></param> /// <param name="data"></param> /// <returns></returns> public static string getZyNextNum(Dao dao, YtService.data.OptData data) { Dictionary <string, object> gz = DaoTool.Get(dao, OptContent.get("ZY_GetDJHGZ"), data); if (gz == null) { gz = new Dictionary <string, object>(); gz["前缀规则"] = "YYYYMM"; gz["主体是否补零"] = "0"; gz["主体长度"] = "5"; gz["起始号"] = null; } string d = ""; try { string qz = getPrestring(gz["前缀规则"].ToString()); string qsh = ""; if (gz["起始号"] != null) { qsh = gz["起始号"].ToString(); } qsh = qsh.Trim(); int ztlength = new ObjItem(gz["主体长度"]).ToInt(); if (ztlength == 0) { ztlength = 5; } data.Param["住院号"] = qz + "%"; data.Param["length"] = qz.Length + ztlength; d = DaoTool.ExecuteScalar(dao, OptContent.get("ZY_GetMaxDJH"), data).ToString(); if (d == null) { d = qz + getBegin(qsh, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } else { if (isLowBegin(d, qsh, gz["前缀规则"].ToString())) { d = qz + getBegin(qsh, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } else { d = qz + getMaxpre(d, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } } } catch { d = ""; } return(d); }
public RegionManageMainView() { InitializeComponent(); mListUserOperations = new List <OperationInfo>(); mListViewColumns = new List <ViewColumnInfo>(); mListUserRegionIDs = new List <long>(); mListRegionItems = new List <ObjItem>(); mRootRegionItem = new ObjItem(); GridTreeRegions.SelectedItemChanged += GridTreeRegions_SelectedItemChanged; }
public void onitemclick(ObjItem p) { if (p._Items._NModel >= (int)ModelEnum.Food && p._Items._NModel <= (int)ModelEnum.FoodEnd) { onfoods(p); } else if (p._Items._NModel >= (int)ModelEnum.Equip && p._Items._NModel <= (int)ModelEnum.EquipEnd) { moduelequip(p._Items); InventoryImpl.Instance().equipon(p); } }
private MeshItem GetMeshObj(ObjItem obj) { var renderObj = GetRenderObject(obj.View.Animator, obj.Flip); return(renderObj == null ? null : new MeshItem() { RenderObject = renderObj, Position = new Vector2(obj.X, obj.Y), FlipX = obj.Flip, Z0 = obj.Z, Z1 = obj.Index, }); }
public void ReloadRegionInfo(ObjItem parent) { try { LoadUserRegionIDs(); parent.Children.Clear(); LoadRegionInfos(parent, parent.ObjID); } catch (Exception ex) { ShowException(ex.Message); } }
private int mViewMode; //1:座位视图;2:状态视图;3:统计视图 #endregion public OnsiteMonitorMainView() { InitializeComponent(); mListRegionItems = new List <ObjItem>(); mListUserRegionIDs = new List <long>(); mRegionRoot = new ObjItem(); mListAllSeatInfos = new List <SeatInfo>(); mListToolBtnItems = new List <ImageButtonItem>(); mListAllStateInfos = new List <AgentStateInfo>(); TreeRegionList.SelectedItemChanged += TreeRegionList_SelectedItemChanged; SliderMapScale.ValueChanged += SliderMapScale_ValueChanged; }
public void equipoff(ObjItem _data) { int eqid = _data._Items._PartId; if (GameResources.Instance()._EquipSolt [eqid].childCount > 0) { ObjItem _curequip = GameResources.Instance()._EquipSolt [eqid].GetComponentInChildren <ObjItem> (); //背包有此物品 就把槽内的gameobject 销毁 增加背包内物品的数量 if (gamedbmgr.Instance().equipadd2inv(_curequip, 1)) { GameObject.Destroy(_curequip.gameObject); } } }
public static ItemEntity FillData(ObjItem item) { ItemEntity itemEntity = new ItemEntity(); itemEntity.ObjId = item.objId; itemEntity.ObjName = item.objName; itemEntity.Count = item.count; itemEntity.Note = item.note; itemEntity.Level = item.level; itemEntity.IsCanAdd = item.isCanAdd; itemEntity.MaxAdd = item.maxAdd; itemEntity.IsChecked = item.isChecked; return(itemEntity); }
public UCAlarmUserSetting() { InitializeComponent(); mListUserTypeItems = new ObservableCollection <ComboItem>(); mListAlarmUserInfos = new List <AlarmUserInfo>(); mListUserItems = new List <ObjItem>(); mListUserIDs = new List <long>(); mRootUserItem = new ObjItem(); Loaded += UCAlarmUserSetting_Loaded; BtnConfirm.Click += BtnConfirm_Click; BtnClose.Click += BtnClose_Click; ComboUserType.SelectionChanged += ComboUserType_SelectionChanged; }
private void GetOneObj() { ObjItem item = null; if (objPool.Count > objItemLayer) { item = CreateFromList(); } else { item = CreateRundomObject(); } InitObj(item); }
private MeshItem GetMeshObj(ObjItem obj) { var renderObj = GetRenderObject(obj.View.Animator, obj.Flip); if (renderObj == null) { return(null); } var mesh = batcher.MeshPop(); mesh.RenderObject = renderObj; mesh.Position = new Vector2(obj.X, obj.Y); mesh.FlipX = obj.Flip; mesh.Z0 = obj.Z; mesh.Z1 = obj.Index; return(mesh); }
private void listBox_Mochilas_SelectedIndexChanged(object sender, EventArgs e) { int indexMochila = listBox_Mochilas.SelectedIndex; ObjParameters parameters = new ObjParameters(); ObjMochila objMochila = parameters.GetMochilas()[indexMochila]; listBox_Itens_Mochila.Items.Clear(); for (int i = 0; i < objMochila.ListItens.Count; i++) { if (objMochila.ListItens[i] == 1) { ObjItem item = parameters.GetItens()[i]; listBox_Itens_Mochila.Items.Add(item.Nome + " = " + item.Peso + "Kg - R$ " + item.Valor); } } }
void getPack() { if (Input.GetKeyDown("u")) { pack.showPack(); } Debug.DrawRay(tr.position, tr.forward * 2.0f, Color.green); RaycastHit hit; if (Physics.Raycast(tr.position, tr.forward, out hit, 2.0f)) { // Debug.Log ("Hit:" + hit.collider.gameObject.name + "\n tag:" + hit.collider.tag); GameObject gameObj = hit.collider.gameObject; ObjItem obj = (ObjItem)gameObj.GetComponent <ObjItem>(); // if (Input.GetKeyDown("e")) // { // Debug.Log("Press 'E'"); // item = gameObj; // gameObj.SetActive(false); // Destroy(gameObj); // item.SetActive(true); // } if (obj != null) { obj.isChecked = true; Debug.Log(obj.objName); if (Input.GetKeyDown(KeyCode.E)) { Debug.Log("keycode E"); item = gameObj.GetComponent <Rigidbody>(); // item = gameObj; isOnHands = true; // gameObj.SetActive(false); // Destroy(gameObj); } } } }
private void listBox_Mochilas_best_SelectedIndexChanged(object sender, EventArgs e) { ObjParameters parameters = new ObjParameters(); string conteudo = listBox_Mochilas_best.SelectedItem.ToString(); int ini = conteudo.IndexOf(" ="); int fin = conteudo.Length - ini; string aux = conteudo.Substring(ini, fin); conteudo = conteudo.Replace(aux, ""); ObjMochila objMochila = parameters.GetMochilas().Single(s => s.Nome == conteudo); listBox_bestItens.Items.Clear(); for (int i = 0; i < objMochila.ListItens.Count; i++) { if (objMochila.ListItens[i] == 1) { ObjItem item = parameters.GetItens()[i]; listBox_bestItens.Items.Add(item.Nome + " = " + item.Peso + "Kg - R$ " + item.Valor); } } }
private void FindAndTryPickupObj() { var colliders = Physics.OverlapSphere(transform.position, radio); foreach (var item in colliders) { if (item.gameObject.layer == 10) { pickupedItem = item.GetComponent <ObjItem>(); if (pickupedItem != null && pickupedItem.waitPick && !pickupedItem.handed) { pickUped = true; if (pickupSequence.armList.Count > 0) { SetValuesDely(pickupSequence.armList[0].values.ToArray()); delyPickDown = true; } } } } }
public void setinfo(ObjItem _item) { _Target = _item; _Name.text = string.Format("{0}{1}</color>", PreHeader.COLORStr[(ModelEnum)_Target._Items._NQuality], _Target._Items._SName); _Desc.text = _Target._Items._SInfo; _Cnt.text = string.Format("强化等级 {0}\n持有数量 {1}", _Target._Items._NLv, _Target._Items._NCnt); //_propstring = PreHeader.COLORStr [_Target._Items._NQuality]; string _propstring = ""; for (int i = 0; i < PreHeader.PROPMAX; ++i) { if (_Target._Items._FValue[i] > 0.2) { _propstring = string.Format("{0}{1} {2}\n", _propstring, PreHeader.PROPTStr[_Target._Items._ValueType[i]], _Target._Items._FValue[i]); } } //_propstring = string.Format("{0}</color>",_propstring); _Prop.text = _propstring; _Icon.sprite = GameResources.loadSprite(_Target._Items._NModel.ToString()); _Frm.sprite = GameResources.loadSprite("ItemBG_" + _Target._Items._NQuality); }