示例#1
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void Init()
    {
        //获取子渠道
        object metaValue       = SDKUtils.GetMetaData(SDKDefine.AndroidSubChannelMeta.key);
        string subChannelValue = metaValue != null?metaValue.ToString() : "";

        if (string.IsNullOrEmpty(subChannelValue))
        {
            subChannelValue = SDKDefine.AndroidSubChannelMeta.value;
        }
        Debug.Log("AndroidChannelSDKMgr::GetMetaData-> SubChannel = " + subChannelValue);
        user.setSubChannel(subChannelValue.Trim());

        //判断是否使用sdk退出方式
        if (user.haveChannelSDK)
        {
            metaValue = SDKUtils.GetMetaData(SDKDefine.AndroidExitTypeMeta.key);
            string exitType = metaValue != null?metaValue.ToString() : "";

            Debug.Log("AndroidChannelSDKMgr::GetMetaData-> exittype = " + exitType);
            if (exitType == SDKDefine.AndroidExitTypeMeta.value) // game:游戏的退出方式;sdk:sdk的退出方式
            {
                // user.useChannelSDKExit = false;
            }
            else
            {
                // user.useChannelSDKExit = true;
            }
        }
        else
        {
            // user.useChannelSDKExit = false;
        }

        //设置监听器
        SetInitListener();
        SetLoginListener();
        SetExitListener();
        SetPayListener();
    }
示例#2
0
    private static string DeterminSDKHelper(out string channelId, out bool haveChannelSDK)
    {
        string SDKHelperName = "";

        object metaValue = SDKUtils.GetMetaData(SDKDefine.OneSDKDefaultChannelIDMeta.key);

        channelId = metaValue != null?metaValue.ToString() : "";

        channelId = channelId.Trim();
        if (channelId != "")
        {
            //如果易接的channelid 不为空就表示使用的易接的SDK
            SDKHelperName  = "AndroidMultSDKHelper";
            haveChannelSDK = true;
        }
        else
        {
            metaValue = SDKUtils.GetMetaData(SDKDefine.MHJSDKDefaultChannelIDMeta.key);
            channelId = metaValue != null?metaValue.ToString() : "";

            channelId = channelId.Trim();
            Debug.Log("channelId = " + channelId.ToString());
            if (channelId == SDKDefine.MHJSDKDefaultChannelIDMeta.value && channelId != "")
            {
                //如果我们自己接的渠道的 channelid 不为空且不是默认值,表示自己接入的渠道
                SDKHelperName  = "AndroidSingleSDKHelper";
                haveChannelSDK = true;
            }
            else
            {
                SDKHelperName  = "ChannelSDKHelperBase";
                haveChannelSDK = false;
            }
        }

        Debug.Log("AndroidChannelSDKMgr::DeterminSDKHelper->SDKHelperName = " + SDKHelperName);
        return(SDKHelperName);
    }