private MCLShareConfig GetNativeShareConfig(MegacoolShareConfig config)
    {
        MCLShareConfig nativeConfig = new MCLShareConfig {
            strategy            = -1,
            popover_source_rect = new MCLRect {
                x      = -1,
                y      = -1,
                width  = -1,
                height = -1,
            },
            popover_permitted_arrow_directions = -1,
        };

        if (config._HasStrategy())
        {
            nativeConfig.strategy = (int)config.Strategy;
        }
        if (config._HasMessage())
        {
            nativeConfig.message = config.Message;
        }
        if (config._HasRecordingId())
        {
            nativeConfig.recordingId = config.RecordingId;
        }
        if (config.Url != null)
        {
            nativeConfig.url = config.Url.ToString();
        }
        if (config.FallbackImage != null)
        {
            nativeConfig.fallback_image = Application.streamingAssetsPath + "/" + config.FallbackImage;
        }
        if (config.Data != null)
        {
            nativeConfig.jsonData = Json.Serialize(config.Data);
        }
        if (config._HasModalLocation())
        {
            nativeConfig.popover_source_rect.x      = config.ModalLocation.x;
            nativeConfig.popover_source_rect.y      = config.ModalLocation.y;
            nativeConfig.popover_source_rect.width  = config.ModalLocation.width;
            nativeConfig.popover_source_rect.height = config.ModalLocation.height;
        }
        if (config._HasModalPermittedArrowDirections())
        {
            nativeConfig.popover_permitted_arrow_directions = (int)config.ModalPermittedArrowDirections;
        }
        return(nativeConfig);
    }
Exemplo n.º 2
0
 public override string ToString()
 {
     return(string.Format("MegacoolShare(State={0}, ReferralCode={1}, Url=\"{2}\", Data={3}, " +
                          "CreatedAt={4}, UpdatedAt={5})",
                          State, ReferralCode.ToString(true), Url, Data == null ? null : Json.Serialize(Data),
                          CreatedAt.ToString("yyyy-MM-ddTHH:mm:ss"), UpdatedAt.ToString("yyyy-MM-ddTHH:mm:ss")));
 }