Exemple #1
0
 /// <summary>
 /// 非经过我同意禁用本接口  by吴江
 /// </summary>
 /// <param name="_info"></param>
 /// <param name="_callBack"></param>
 /// <returns></returns>
 public bool TryPreviewSingelMonster(MonsterInfo _info, System.Action <PreviewMob> _callBack)
 {
     if (_info != null)
     {
         PreviewMob pp = PreviewMob.CreateDummy(_info);
         pp.mutualExclusion = false;
         pp.StartAsyncCreate(_callBack);
         return(true);
     }
     return(false);
 }
Exemple #2
0
 public bool TryPreviewSingelMonster(MonsterInfo _info, UITexture _showLabel, PreviewConfigType _previewType)
 {
     curShowLabel = _showLabel;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewMob pp = PreviewMob.CreateDummy(_info);
         pp.previewConfigType = _previewType;
         pp.StartAsyncCreate(CreateMonsterCallBack);
         return(true);
     }
     return(false);
 }
Exemple #3
0
    public bool TryPreviewSingelMonster(int _configID, UITexture _showLabel, PreviewConfigType _previewType)
    {
        curShowLabel = _showLabel;
        CancelAllDownLoad();
        MonsterRef  refData = ConfigMng.Instance.GetMonsterRef(_configID);
        MonsterInfo info    = new MonsterInfo(refData);

        if (info != null)
        {
            PreviewMob pp = PreviewMob.CreateDummy(info);
            pp.previewConfigType = _previewType;
            pp.StartAsyncCreate(CreateMonsterCallBack);
            return(true);
        }
        return(false);
    }
Exemple #4
0
    /// <summary>
    /// 创建净数据对象 by吴江
    /// </summary>
    /// <param name="_info"></param>
    /// <returns></returns>
    public static PreviewMob CreateDummy(MonsterInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyMobPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyMobPrefab) as GameObject;
            newGO.name = "Dummy PreviewMob [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy PreviewMob[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Monster";
        PreviewMob mob = newGO.AddComponent <PreviewMob>();

        mob.actorInfo = _info;
        mob.isDummy_  = true;
        return(mob);
    }
Exemple #5
0
    public void CreateMonsterCallBack(PreviewMob _mob)
    {
        // previewCamera.fieldOfView = 60.0f;
        //防止有之前延迟的模型加载,再次清理
        ClearModel();
        previewMob = _mob;
        GameObject parent = GetModelTransform(_mob.PreviewPosition, _mob.PreviewRotation);

        if (null != parent)
        {
            _mob.transform.parent           = parent.transform;
            _mob.transform.localPosition    = new Vector3(0, -_mob.Height / 2f, 0);
            _mob.transform.localEulerAngles = new Vector3(0, 180f, 0);
        }
        _mob.FaceToNoLerp(180f);
        UIDragObjectRotate3D _UIDragObjectRotate3D = curShowLabel.gameObject.GetComponent <UIDragObjectRotate3D>();

        if (_UIDragObjectRotate3D == null)
        {
            _UIDragObjectRotate3D = curShowLabel.gameObject.AddComponent <UIDragObjectRotate3D>();
        }
        _UIDragObjectRotate3D.target = _mob;
        BindRenderAndUI(curShowLabel);
    }
Exemple #6
0
    IEnumerator CreateAsync(System.Action <PreviewMob> _callback)
    {
        if (isDummy_ == false)
        {
            GameSys.LogError("You can only start create Mob in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }

        //
        PreviewMob mob    = null;
        bool       failed = false;

        pendingDownload = Create(actorInfo, delegate(PreviewMob _mob, EResult _result)
        {
            if (_result != EResult.Success)
            {
                failed = true;
                return;
            }
            mob = _mob;
            float previewScale = Mathf.Max(0, actorInfo.PreviewScale(previewConfigType));
            if (previewScale == 0)
            {
                previewScale = 1;
            }
            mob.transform.localScale *= previewScale;
            pendingDownload           = null;
        });
        if (mutualExclusion)
        {
            GameCenter.previewManager.PushDownLoadTask(pendingDownload);
        }
        while (mob == null || mob.inited == false)
        {
            if (failed)
            {
                yield break;
            }
            yield return(null);
        }
        if (mutualExclusion)
        {
            GameCenter.previewManager.EndDownLoadTask(pendingDownload);
        }
        pendingDownload = null;

        if (GameCenter.curGameStage == null)
        {
            yield break;
        }

        if (!actorInfo.IsAlive)
        {
            mob.Dead();
        }
        mob.isDownloading_ = false;

        if (_callback != null)
        {
            _callback(mob);
        }
    }