コード例 #1
0
    public int PlaySpine(int templateId, Transform host, string uibase, int depthValue = 2001, Action finishCallback = null, string layer = "UI", float xOffset = 0f, float yOffset = 0f, float xScale = 1f, float yScale = 1f, bool stencilMask = false, FXMaskLayer.MaskState maskState = FXMaskLayer.MaskState.None)
    {
        if (this.IsLockWhenDeleteAllSpine)
        {
            return(0);
        }
        if (!string.IsNullOrEmpty(ClientGMManager.spineout_ids))
        {
            string[] array = ClientGMManager.spineout_ids.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                if (int.Parse(array[i]) == templateId)
                {
                    return(0);
                }
            }
        }
        if (!SystemConfig.IsUIFXOn)
        {
            return(0);
        }
        if (templateId <= 0)
        {
            return(0);
        }
        if (host == null)
        {
            return(0);
        }
        FXSpine fXSpine = DataReader <FXSpine> .Get(templateId);

        if (fXSpine == null)
        {
            return(0);
        }
        if (string.IsNullOrEmpty(fXSpine.name))
        {
            return(0);
        }
        int uid = ++this.m_fxOfcounter;

        this.m_fxSpines.set_Item(uid, null);
        this.PreloadAsset(templateId, delegate
        {
            if (this.m_fxSpines.ContainsKey(uid))
            {
                this.JustPlaySpine(uid, templateId, host, uibase, depthValue, finishCallback, layer, xOffset, yOffset, xScale, yScale, stencilMask, maskState);
            }
        });
        return(uid);
    }
コード例 #2
0
    public int ReplaySpine(int uid, int templateId, Transform host, string uibase, int depthValue = 2001, Action finishCallback = null, string layer = "UI", float xOffset = 0f, float yOffset = 0f, float xScale = 1f, float yScale = 1f, bool stencilMask = false, FXMaskLayer.MaskState maskState = FXMaskLayer.MaskState.None)
    {
        if (this.IsLockWhenDeleteAllSpine)
        {
            return(0);
        }
        if (!SystemConfig.IsUIFXOn)
        {
            return(0);
        }
        if (templateId <= 0)
        {
            return(0);
        }
        if (host == null)
        {
            return(0);
        }
        if (uid <= 0 || !this.m_fxSpines.ContainsKey(uid))
        {
            return(this.PlaySpine(templateId, host, uibase, depthValue, finishCallback, layer, xOffset, yOffset, xScale, yScale, stencilMask, maskState));
        }
        ActorFXSpine actorFXSpine = this.m_fxSpines.get_Item(uid);

        if (actorFXSpine != null)
        {
            actorFXSpine.PlaySpine();
            return(uid);
        }
        this.m_fxSpines.Remove(uid);
        return(this.PlaySpine(templateId, host, uibase, depthValue, finishCallback, layer, xOffset, yOffset, xScale, yScale, stencilMask, maskState));
    }
コード例 #3
0
    private void JustPlaySpine(int uid, int templateId, Transform host, string uibase, int depthValue, Action finishCallback, string layer, float xOffset, float yOffset, float xScale, float yScale, bool stencilMask, FXMaskLayer.MaskState maskState = FXMaskLayer.MaskState.None)
    {
        FXSpine fXSpine = DataReader <FXSpine> .Get(templateId);

        if (fXSpine == null || string.IsNullOrEmpty(fXSpine.name))
        {
            return;
        }
        if (host == null)
        {
            return;
        }
        ActorFXSpine actorFXSpine = FXSpinePool.Instance.Get(templateId);

        if (actorFXSpine == null)
        {
            return;
        }
        actorFXSpine.get_transform().set_name(templateId.ToString());
        if (maskState != FXMaskLayer.MaskState.None)
        {
            FXMaskLayer fXMaskLayer = actorFXSpine.get_gameObject().AddUniqueComponent <FXMaskLayer>();
            fXMaskLayer.state = maskState;
        }
        this.m_fxSpines.set_Item(uid, actorFXSpine);
        actorFXSpine.get_transform().set_parent(host);
        actorFXSpine.get_transform().set_localPosition(new Vector3(xOffset, yOffset, 0f));
        actorFXSpine.get_transform().set_localRotation(Quaternion.get_identity());
        actorFXSpine.get_transform().set_localScale(new Vector3(xScale, yScale, 1f));
        LayerSystem.SetGameObjectLayer(actorFXSpine.get_gameObject(), layer, 1);
        DepthOfFX depthOfFX = actorFXSpine.get_gameObject().AddMissingComponent <DepthOfFX>();

        depthOfFX.SortingOrder       = depthValue;
        actorFXSpine._uid            = uid;
        actorFXSpine._dataSpine      = fXSpine;
        actorFXSpine._uibase         = uibase;
        actorFXSpine._depth          = depthValue;
        actorFXSpine._stencilMask    = stencilMask;
        actorFXSpine._finishCallback = finishCallback;
        actorFXSpine.AwakeSelf();
        actorFXSpine.get_gameObject().SetActive(true);
        actorFXSpine.PlaySpine();
        this.DoSetShader(actorFXSpine, stencilMask, fXSpine);
        this.PlaySound(fXSpine);
    }