Exemplo n.º 1
0
    public void EmployEmployee(int cattypeid)
    {
        if (manorInfoProxy.catDic[cattypeid].HirePrice <= userInfoProxy.UsertData.Gold)
        {
            bool islimt = catgroupproxy.limitCatGroupNum(5, 1);
            if (islimt)
            {
                failtype = EnumGlobal.FailType.LimitNum;

                Facade.SendNotification(EmployeeMediator.EMPLOY_FAILURE, failtype);
            }
            else
            {
                DbAccess dbAccess = new DbAccess();
                dbAccess.InsertIntoSpecific("info_cats",
                                            new string[] { "cattypeid", "groupId", "userid" },
                                            new string[] { cattypeid.ToString(), "5", userInfoProxy.UsertData.Id.ToString() });
                SqliteDataReader read = dbAccess.ReadMaxIDFromTable("info_cats");
                int id = Utils.GetInt(read[0]);
                dbAccess.CloseSqlConnection();
                catgroupproxy.addCatByEmloyee(id, 5, cattypeid, userInfoProxy.UsertData.Id);
                userInfoProxy.SetGold(userInfoProxy.UsertData.Gold - manorInfoProxy.catDic[cattypeid].HirePrice);

                Facade.SendNotification(EmployeeMediator.EMPLOY_SUCCESS);
            }
        }
        else
        {
            failtype = EnumGlobal.FailType.Money;

            Facade.SendNotification(EmployeeMediator.EMPLOY_FAILURE, failtype);
        }
    }
Exemplo n.º 2
0
    public void  EmployFailure(object data)
    {
        EnumGlobal.FailType fialtype = (EnumGlobal.FailType)data;
        if (fialtype == EnumGlobal.FailType.Money)
        {
            Debug.Log("金钱不够!雇佣失败!");
            string s = "金钱不够!雇佣失败!";
            NotifactionFunc._instance.showNotifaction(s);
        }
        else if (fialtype == EnumGlobal.FailType.LimitNum)
        {
            string s = "仓库已经达到最大限制数,雇佣失败!请清除库存猫成员后雇佣!";
            NotifactionFunc._instance.showNotifaction(s);
        }



        GameObject employeeCat = catPosition.transform.GetChild(0).gameObject;

        employeeCat.SetActive(false);
        employPanel.SetActive(false);
    }