Beispiel #1
0
    public void Request_NpcActive(NpcTypeID rNpcId, bool rActive = true)
    {
        moduleGlobal.LockUI(string.Empty, 0.5f);

        var p = PacketObject.Create <CsNpcActive>();

        p.npcId  = (byte)rNpcId;
        p.active = rActive;
        session.Send(p);
    }
Beispiel #2
0
    public void Request_NpcPerfusion(NpcTypeID rNpcId, int rTimes)
    {
        moduleGlobal.LockUI(string.Empty, 0.5f);

        var p = PacketObject.Create <CsNpcPerfusion>();

        p.npcId = (byte)rNpcId;
        p.times = (ushort)rTimes;
        session.Send(p);
    }
Beispiel #3
0
    public void SwitchNpc(NpcTypeID rNpcId)
    {
        if (currentNpc?.npcType == rNpcId)
        {
            return;
        }
        npc_Type = rNpcId;

        npc_creatrue?.Destroy();
        Create_Npc();
    }
Beispiel #4
0
    /// <summary>
    /// 设置当前界面的NPCTYPE,主要是用在有NPC模型展示的window界面
    /// </summary>
    /// <param name="npcid">npcmono上的NPCID</param>
    public void SetCurNpc(NpcTypeID npcid)
    {
        if (npcid == NpcTypeID.None)
        {
            npcid = NpcTypeID.TravalShopNpc;
        }

        curNpc = GetTargetNpc(npcid);
        if (curNpc != null)
        {
            Logger.LogDetail("curNpc= {0} type = {1}", curNpc.npcId, curNpc.npcType);
        }
    }
Beispiel #5
0
    /// <summary>
    /// 根据ID获取对应的NPC的信息
    /// </summary>
    /// <param name="npcid"></param>
    /// <returns></returns>
    public NpcMessage GetTargetNpc(NpcTypeID npcid)
    {
        if (!m_allNpcInfo.ContainsKey(npcid))
        {
            if (npcid == NpcTypeID.None)
            {
                return(null);
            }

            NpcMessage.CreateDefault((int)npcid);
            m_allNpcInfo.Add(npcid, NpcMessage.defaultNpc);
            return(NpcMessage.defaultNpc);
        }
        return(m_allNpcInfo.Get(npcid));
    }
    public override bool Initialize(params object[] p)
    {
        if (!base.Initialize(p))
        {
            if (_npcId == (NpcTypeID)p[0])
            {
                return(false);
            }
        }
        else
        {
            _excuteButton?.onClick.AddListener(OnExcuteClick);
        }

        _npcId = (NpcTypeID)p[0];
        var npcInfo = moduleNpc.GetTargetNpc(_npcId);

        if (_icon)
        {
            AtlasHelper.SetAvatar(_icon.gameObject, npcInfo.icon);
        }
        Util.SetText(_npcName, npcInfo.name);

        if (npcInfo.fetterLv == npcInfo.maxFetterLv)
        {
            Util.SetText(_exp, ConfigText.GetDefalutString(TextForMatType.NpcAwakeUI, 9));
            if (_slider)
            {
                _slider.fillAmount = 1;
            }
        }
        else
        {
            Util.SetText(_exp, $"{npcInfo.nowFetterValue}/{npcInfo.toFetterValue}");
            Util.SetText(_level, npcInfo.fetterLv.ToString());
            if (_slider)
            {
                _slider.fillAmount = npcInfo.fetterProgress;
            }
        }
        Util.SetText(_level, npcInfo.fetterLv.ToString());

        RefreshAttribute();
        RefreshExcuteButton();

        _lock.SafeSetActive(!npcInfo.isUnlockEngagement);
        return(true);
    }
Beispiel #7
0
    public override bool Initialize(params object[] p)
    {
        var watcher = TimeWatcher.Watch("star panel init");

        if (!base.Initialize(p))
        {
            return(false);
        }

        _npcId = (NpcTypeID)p[0];
        _npc   = moduleNpc.GetTargetNpc(_npcId);
        AtlasHelper.SetAvatar(_headIcon, _npc?.icon);

        watcher.See("111");
        excuteButton?.onClick.AddListener(OnExcute);
        RefreshUI();
        watcher.See("222");
        return(true);
    }
Beispiel #8
0
 /// <summary>
 /// 通过参数NPCID 获得所有与该NPC的任务
 /// </summary>
 /// <param name="npctypeid"></param>
 /// <returns></returns>
 public List <Task> GetTask(NpcTypeID npctypeid)
 {
     return(m_taskList.FindAll((p) => p.taskTargetID == npctypeid));
 }