コード例 #1
0
 /// <summary>
 /// 设置职业数据
 /// </summary>
 public void SetWorkerInfo(CharacterBaseBean characterBase)
 {
     if (characterBase == null)
     {
         return;
     }
     if (detailsForChef != null)
     {
         detailsForChef.SetData(WorkerEnum.Chef, characterBase.chefInfo);
     }
     if (detailsForWaiter != null)
     {
         detailsForWaiter.SetData(WorkerEnum.Waiter, characterBase.waiterInfo);
     }
     if (detailsForAccounting != null)
     {
         detailsForAccounting.SetData(WorkerEnum.Accountant, characterBase.accountantInfo);
     }
     if (detailsForAccost != null)
     {
         detailsForAccost.SetData(WorkerEnum.Accost, characterBase.accostInfo);
     }
     if (detailsForBeater != null)
     {
         detailsForBeater.SetData(WorkerEnum.Beater, characterBase.beaterInfo);
     }
 }
コード例 #2
0
ファイル: ItemGameWorkerCpt.cs プロジェクト: wobushiren79/IL
    /// <summary>
    /// 设置数据
    /// </summary>
    /// <param name="data"></param>
    public virtual void SetData(CharacterBean data)
    {
        if (data == null)
        {
            return;
        }

        characterData = data;

        if (characterData.baseInfo != null)
        {
            CharacterBaseBean characterBase = characterData.baseInfo;
            SetName(characterBase.name);

            SetPrice(characterBase.priceS, characterBase.priceM, characterBase.priceL);
            SetWork(
                characterBase.chefInfo.isWorking,
                characterBase.waiterInfo.isWorkingForSend, characterBase.waiterInfo.isWorkingForCleanTable, characterBase.waiterInfo.isWorkingCleanBed,
                characterBase.accountantInfo.isWorking,
                characterBase.accostInfo.isWorkingForSolicit, characterBase.accostInfo.isWorkingForGuide,
                characterBase.beaterInfo.isWorking);
            SetPriority(
                characterBase.chefInfo.priority,
                characterBase.waiterInfo.priorityForSend, characterBase.waiterInfo.priorityForCleanTable, characterBase.waiterInfo.priorityForCleanBed,
                characterBase.accountantInfo.priority,
                characterBase.accostInfo.priorityForSolicit, characterBase.accostInfo.priorityForGuide,
                characterBase.beaterInfo.priority);

            WorkerStatusEnum workerStatus = characterBase.GetWorkerStatus(out string workerStatusStr);
            SetStatus(workerStatus, workerStatusStr);
        }
        if (characterData.attributes != null)
        {
            CharacterAttributesBean characterAttributes = characterData.attributes;
            SetLoyal(characterAttributes.loyal);
            SetAttributes(characterData.attributes, characterData.equips);
        }
        if (data.body != null && data.equips != null)
        {
            characterUICpt.SetCharacterData(data.body, data.equips);
            SetSex(data.body.sex);
        }
        //如果是用户,则不能解雇 也不能送礼
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        if (data == gameData.userCharacter || data is CharacterForFamilyBean)
        {
            if (btFire != null)
            {
                btFire.gameObject.SetActive(false);
            }
            if (btGift != null)
            {
                btGift.gameObject.SetActive(false);
            }
        }
        else
        {
            if (btFire != null)
            {
                btFire.gameObject.SetActive(true);
            }
            if (btGift != null)
            {
                btGift.gameObject.SetActive(true);
            }
        }
        SetLevelUp(characterData);


        if (infoCharacterPopup != null)
        {
            infoCharacterPopup.SetData(characterData);
        }
    }