public void _FittingDown(uint itemId) { if (itemId == 0) { Debug.Log("FittingUp itemId : " + itemId); return; } FashionItem item = GameSystem.Instance.FashionConfig.GetConfig(itemId); if (item == null) { Debug.LogError("Can not fashion item: " + itemId); return; } BodyInfo bodyInfo = null; // TODO: check wheather use the shape id GameSystem.Instance.BodyInfoListConfig.configs.TryGetValue((uint)_shapeID, out bodyInfo); FashionMatch fMatch = null; item.fashion_matchs.TryGetValue(bodyInfo.type_id, out fMatch); Transform FittingTrans = GameUtils.FindChildRecursive(mPlayer.gameObject.transform, string.Format("{0} Spine2", m_bipName)).FindChild(fMatch.shape_id + "(Clone)"); if (FittingTrans == null) { Debug.Log("Can't Find Fitting Down Goods"); return; } GameObject.DestroyImmediate(FittingTrans.gameObject); GameUtils.SetLayerRecursive(mPlayer.gameObject.transform, LayerMask.NameToLayer(_layerName)); }
public FashionItem GetConfig(uint fashion_id) { FashionItem data = null; configs.TryGetValue(fashion_id, out data); return(data); }
static int GetConfig(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); FashionConfig obj = (FashionConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "FashionConfig"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); FashionItem o = obj.GetConfig(arg0); LuaScriptMgr.PushObject(L, o); return(1); }
// GET: Admin/FashionItems/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FashionItem fashionItem = db.FashionItems.Find(id); if (fashionItem == null) { return(HttpNotFound()); } ViewBag.AuthorId = new SelectList(db.Authors, "Id", "Name", fashionItem.AuthorId); ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", fashionItem.CategoryId); return(View(fashionItem)); }
// GET: Admin/FashionItems/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FashionItem fashionItem = db.FashionItems.Find(id); if (fashionItem == null) { return(HttpNotFound()); } db.FashionItems.Remove(fashionItem); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Id,CategoryId,AuthorId,PhotoUpload,Tittle,Description,Date,Status")] FashionItem fashionItem) { try { fashionItem.Photo = FileManager.Upload(fashionItem.PhotoUpload); } catch (Exception e) { ModelState.AddModelError("PhotoUpload", e.Message); } if (ModelState.IsValid) { db.FashionItems.Add(fashionItem); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fashionItem)); }
public ActionResult Edit([Bind(Include = "Id,CategoryId,AuthorId,Photo,Tittle,Description,Date,Status,PhotoUpload")] FashionItem fashionItem) { try { fashionItem.Photo = FileManager.Upload(fashionItem.PhotoUpload); } catch (Exception e) { ModelState.AddModelError("PhotoUpload", e.Message); } if (ModelState.IsValid) { db.Entry(fashionItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AuthorId = new SelectList(db.Authors, "Id", "Name", fashionItem.AuthorId); ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", fashionItem.CategoryId); return(View(fashionItem)); }
public void _FittingUp(uint itemId) { if (itemId == 0) { Debug.Log("FittingUp itemId : " + itemId); return; } FashionItem item = GameSystem.Instance.FashionConfig.GetConfig(itemId); if (item == null) { Debug.LogError("Can not fashion item: " + itemId); return; } BodyInfo bodyInfo = null; // TODO: check wheather use the shape id GameSystem.Instance.BodyInfoListConfig.configs.TryGetValue((uint)_shapeID, out bodyInfo); FashionMatch fMatch = null; item.fashion_matchs.TryGetValue(bodyInfo.type_id, out fMatch); string strResPath = string.Format("Object/Fashion/{0}/{0}", fMatch.shape_id); Object resDress = ResourceLoadManager.Instance.GetResources(strResPath); GameObject goDress = GameObject.Instantiate(resDress) as GameObject; Transform parentTrans = GameUtils.FindChildRecursive(mPlayer.gameObject.transform, string.Format("{0} Spine2", m_bipName)); goDress.transform.parent = parentTrans; goDress.transform.localPosition = ((GameObject)resDress).transform.position; goDress.transform.localRotation = ((GameObject)resDress).transform.rotation; goDress.transform.localScale = ((GameObject)resDress).transform.localScale; GameUtils.SetLayerRecursive(mPlayer.gameObject.transform, LayerMask.NameToLayer(_layerName)); }
public void ReadConfig() { if (isLoadFinish == false) { return; } isLoadFinish = false; lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; } Debug.Log("Config reading " + name1); string text = ResourceLoadManager.Instance.GetConfigText(name1); if (text == null) { Debug.LogError("LoadConfig failed: " + name1); return; } //读取以及处理XML文本的类 XmlDocument doc = CommonFunction.LoadXmlConfig(name1, text); XmlNode node_data = doc.SelectSingleNode("Data"); foreach (XmlNode node_line in node_data.SelectNodes("Line")) { if (node_line.SelectSingleNode("switch").InnerText == "#") { continue; } FashionItem data = new FashionItem(); data.fashion_id = uint.Parse(node_line.SelectSingleNode("id").InnerText); for (int i = 0; i < 6; i++) { string tmp = "shape_id" + (i + 1); string shaderID = node_line.SelectSingleNode(tmp).InnerText; if (shaderID == "") { continue; } FashionMatch item = new FashionMatch(); item.shape_id = shaderID; tmp = "bone_id" + (i + 1); string strHideId = node_line.SelectSingleNode(tmp).InnerText; string[] tokens = strHideId.Split('&'); foreach (string token in tokens) { uint hide_Id; if (uint.TryParse(token, out hide_Id)) { item.hide_id.Add(hide_Id); } } tmp = "body_type" + (i + 1); item.body_type = node_line.SelectSingleNode(tmp).InnerText; data.fashion_matchs.Add(item.body_type, item); } configs.Add(data.fashion_id, data); } Debug.Log("Config reading " + name2); text = ResourceLoadManager.Instance.GetConfigText(name2); if (text == null) { Debug.LogError("LoadConfig failed: " + name2); return; } //读取以及处理XML文本的类 doc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_BONE_MAPPING, text); node_data = doc.SelectSingleNode("Data"); foreach (XmlNode node_line in node_data.SelectNodes("Line")) { HidePart data = new HidePart(); data.hide_id = uint.Parse(node_line.SelectSingleNode("id").InnerText); data.part_id = node_line.SelectSingleNode("part").InnerText; mapHideParts.Add(data.hide_id, data); } Debug.Log("Config reading " + name3); text = ResourceLoadManager.Instance.GetConfigText(name3); if (text == null) { Debug.LogError("LoadConfig failed: " + name3); return; } //读取以及处理XML文本的类 doc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_FASHIONATTR, text); node_data = doc.SelectSingleNode("Data"); foreach (XmlNode node_line in node_data.SelectNodes("Line")) { if (node_line.SelectSingleNode("switch").InnerText == "#") { continue; } FashionAttr fashionAttr = new FashionAttr(); fashionAttr.attr_id = uint.Parse(node_line.SelectSingleNode("attrs_id").InnerText); string attrsStr = node_line.SelectSingleNode("attrs").InnerText.ToString(); string[] attr = attrsStr.Split(':'); fashionAttr.player_attr_id = uint.Parse(attr[0]); fashionAttr.player_attr_num = uint.Parse(attr[1]); if (!fashionAttrs.ContainsKey(fashionAttr.attr_id)) { fashionAttrs.Add(fashionAttr.attr_id, fashionAttr); } } Debug.Log("Config reading " + name4); text = ResourceLoadManager.Instance.GetConfigText(name4); if (text == null) { Debug.LogError("LoadConfig failed: " + name4); return; } //读取以及处理XML文本的类 doc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_FASHIONDATA, text); node_data = doc.SelectSingleNode("Data"); foreach (XmlNode node_line in node_data.SelectNodes("Line")) { if (node_line.SelectSingleNode("switch").InnerText == "#") { continue; } FashionData fashionData = new FashionData(); fashionData.fashion_id = uint.Parse(node_line.SelectSingleNode("id").InnerText); string resetInfo = node_line.SelectSingleNode("reset_price").InnerText.ToString(); string[] resetArr = resetInfo.Split(':'); fashionData.reset_id = uint.Parse(resetArr[0]); fashionData.reset_num = uint.Parse(resetArr[1]); if (!fashionDatas.ContainsKey(fashionData.fashion_id)) { fashionDatas.Add(fashionData.fashion_id, fashionData); } } }
public void _DressDown(string strType, uint itemId) { FashionItem item = GameSystem.Instance.FashionConfig.GetConfig(itemId); if (item == null) { Debug.LogError("Can not fashion item: " + itemId); return; } BodyInfo bodyInfo = null; // TODO: check wheather use the shape id GameSystem.Instance.BodyInfoListConfig.configs.TryGetValue((uint)_shapeID, out bodyInfo); FashionMatch fMatch = null; item.fashion_matchs.TryGetValue(bodyInfo.type_id, out fMatch); if (fMatch == null) { return; } string shapeId = fMatch.shape_id; //if( shapeId.StartsWith("Skin_") ) //{ // shapeId = shapeId.Remove(0, 5); //} Transform fashonTran = mPlayer.gameObject.transform.FindChild(fMatch.shape_id.Remove(0, 5)); fashonTran = null; if (fashonTran == null) { string strResPath = string.Format("Object/Fashion/{0}/{0}", fMatch.shape_id); Object resDress = ResourceLoadManager.Instance.GetResources(strResPath); GameObject goDress = GameObject.Instantiate(resDress) as GameObject; SkinnedMeshRenderer[] skinMeshes = goDress.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer skin in skinMeshes) { Transform sfashonTran = mPlayer.gameObject.transform.FindChild(skin.name); if (sfashonTran != null) { if (m_bFashionMode) { GameObject.Destroy(sfashonTran.gameObject); } else { GameObject.DestroyImmediate(sfashonTran.gameObject); } } else { //Debug.LogError("get rid of skin failed for the skin.name=" + skin.name); } } if (m_bFashionMode) { GameObject.Destroy(goDress); } else { GameObject.DestroyImmediate(goDress); } // return; } if (fashonTran != null) { if (m_bFashionMode) { GameObject.Destroy(fashonTran.gameObject); } else { GameObject.DestroyImmediate(fashonTran.gameObject); } } //string strResPath = string.Format("Object/Fashion/{0}/{0}", fMatch.shape_id); //Object resDress = ResourceLoadManager.Instance.GetResources(strResPath); //GameObject goDress = GameObject.Instantiate(resDress) as GameObject; //GameUtils.ReSkinning(goDress, mPlayer.m_goPlayer); //GameObject.Destroy(goDress); //if( m_bFashionMode ) { foreach (uint hide in fMatch.hide_id) { HidePart hp = GameSystem.Instance.FashionConfig.MappingPart(hide); if (hp == null) { continue; } string strHidePart = (mPlayer.m_gender == fogs.proto.msg.GenderType.GT_FEMALE ? "G_" : "M_") + hp.part_id; Transform trSkin = GameUtils.FindChildRecursive(mPlayer.gameObject.transform, strHidePart); if (trSkin == null) { continue; } trSkin.gameObject.GetComponent <Renderer>().enabled = true; } } // mPlayer.m_goPlayer.layer = LayerMask.NameToLayer("Player"); GameUtils.SetLayerRecursive(mPlayer.gameObject.transform, LayerMask.NameToLayer(_layerName)); //Resources.UnloadUnusedAssets(); }
public void _DressUp(string strType, uint itemId) { if (itemId == 0) { Debug.Log("fashion item id is : " + itemId); return; } FashionItem item = GameSystem.Instance.FashionConfig.GetConfig(itemId); if (item == null) { Debug.LogError("Can not fashion item: " + itemId); return; } BodyInfo bodyInfo = null; // TODO: check wheather use the shape id GameSystem.Instance.BodyInfoListConfig.configs.TryGetValue((uint)_shapeID, out bodyInfo); FashionMatch fMatch = null; item.fashion_matchs.TryGetValue(bodyInfo.type_id, out fMatch); if (fMatch == null) { return; } Transform fashonTran = mPlayer.gameObject.transform.FindChild(fMatch.shape_id.Remove(0, 5)); if (fashonTran != null) { return; } string strResPath = string.Format("Object/Fashion/{0}/{0}", fMatch.shape_id); Object resDress = ResourceLoadManager.Instance.GetResources(strResPath); GameObject goDress = GameObject.Instantiate(resDress) as GameObject; GameUtils.ReSkinning(goDress, mPlayer.gameObject); GameObject.Destroy(goDress); foreach (uint hide in fMatch.hide_id) { HidePart hp = GameSystem.Instance.FashionConfig.MappingPart(hide); if (hp == null) { continue; } string strHidePart = (mPlayer.m_gender == fogs.proto.msg.GenderType.GT_FEMALE ? "G_" : "M_") + hp.part_id; Transform trSkin = GameUtils.FindChildRecursive(mPlayer.gameObject.transform, strHidePart); if (trSkin == null) { continue; } trSkin.gameObject.GetComponent <Renderer>().enabled = false; } GameUtils.SetLayerRecursive(mPlayer.gameObject.transform, LayerMask.NameToLayer(_layerName)); }