public Api_Result <object> Buy(int mst_id) { Api_Result <object> api_Result = new Api_Result <object>(); Mst_furniture mst_furniture = null; if (!Mst_DataManager.Instance.Mst_furniture.TryGetValue(mst_id, ref mst_furniture)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (Comm_UserDatas.Instance.User_furniture.ContainsKey(mst_id)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Mem_basic user_basic = Comm_UserDatas.Instance.User_basic; if (mst_furniture.Saleflg == 0 || user_basic.Fcoin < mst_furniture.Price) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Mem_useitem mem_useitem = null; if (mst_furniture.IsRequireWorker()) { if (!Comm_UserDatas.Instance.User_useItem.TryGetValue(52, ref mem_useitem)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (mem_useitem.Value <= 0) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } } if (!Comm_UserDatas.Instance.Add_Furniture(mst_id)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } user_basic.SubCoin(mst_furniture.Price); if (mem_useitem != null) { mem_useitem.Sub_UseItem(1); } return(api_Result); }
public bool IsNeedWorker() { return(_mst.IsRequireWorker()); }