private void saveIglooLayoutChanges(System.Action onSyncStopped = null, IIglooUpdateLayoutErrorHandler errorHandler = null) { bool flag = false; foreach (SceneLayoutData item in sceneLayoutDataModified.Keys.ToList()) { if (!sceneLayoutDataModified[item]) { continue; } MutableSceneLayout mutableSceneLayout = new MutableSceneLayout(); ConvertToMutableSceneLayout(mutableSceneLayout, item); foreach (ExtraLayoutInfoLoader extraLayoutInfoLoader in extraLayoutInfoLoaders) { ExtraLayoutInfo extraLayoutInfo = extraLayoutInfoLoader(); mutableSceneLayout.extraInfo[extraLayoutInfo.Key] = extraLayoutInfo.Value; } EventHandlerDelegate <IglooServiceEvents.IglooLayoutUpdated> successHandler = null; successHandler = delegate { Service.Get <EventDispatcher>().RemoveListener(successHandler); onSyncStopped.InvokeSafe(); return(false); }; Service.Get <EventDispatcher>().AddListener(successHandler); IIglooUpdateLayoutErrorHandlerWrapper errorHandler2 = new IIglooUpdateLayoutErrorHandlerWrapper(successHandler, errorHandler); Service.Get <INetworkServicesManager>().IglooService.UpdateIglooLayout(item.LayoutId, mutableSceneLayout, errorHandler2); sceneLayoutDataModified[item] = false; flag = true; } if (!flag) { onSyncStopped.InvokeSafe(); } }
public IglooUpdateAndPublish(IIglooService iglooService, IIglooUpdateAndPublishErrorHandler errorHandler, long layoutId, IglooVisibility?visibility, MutableSceneLayout sceneLayout) { this.iglooService = iglooService; this.errorHandler = errorHandler; this.layoutId = layoutId; this.visibility = visibility; this.sceneLayout = sceneLayout; eventChannel = new EventChannel(Service.Get <EventDispatcher>()); }
public static void ConvertToMutableSceneLayout(MutableSceneLayout mutableSceneLayout, SceneLayoutData sceneLayoutData) { mutableSceneLayout.zoneId = sceneLayoutData.LotZoneName; mutableSceneLayout.lightingId = sceneLayoutData.LightingId; mutableSceneLayout.musicId = sceneLayoutData.MusicTrackId; mutableSceneLayout.extraInfo = sceneLayoutData.ExtraInfo; mutableSceneLayout.decorationsLayout = new List <DecorationLayout>(); foreach (DecorationLayoutData item2 in sceneLayoutData.GetLayoutEnumerator()) { DecorationLayout item = default(DecorationLayout); ref DecorationLayout.Id id = ref item.id; DecorationLayoutData.ID id2 = item2.Id; id.name = id2.Name; ref DecorationLayout.Id id3 = ref item.id;
public void UpdateIglooLayout(long layoutId, MutableSceneLayout sceneLayout, IIglooUpdateLayoutErrorHandler errorHandler = null) { APICall <UpdateIglooLayoutOperation> aPICall = clubPenguinClient.IglooApi.UpdateIglooLayout(layoutId, sceneLayout); aPICall.OnResponse += onUpdateIglooLayout; aPICall.OnError += delegate(UpdateIglooLayoutOperation op, HttpResponse HttpResponse) { if (errorHandler != null) { errorHandler.OnUpdateLayoutError(); } else { handleCPResponseError(op, HttpResponse); } }; aPICall.Execute(); }
public void CreateIglooLayout(MutableSceneLayout sceneLayout, IIglooCreateErrorHandler errorHandler = null) { APICall <CreateIglooLayoutOperation> aPICall = clubPenguinClient.IglooApi.CreateIglooLayout(sceneLayout); aPICall.OnResponse += onCreateIglooLayout; aPICall.OnError += delegate(CreateIglooLayoutOperation op, HttpResponse HttpResponse) { if (errorHandler != null) { errorHandler.OnCreateLayoutError(); } else { handleCPResponseError(op, HttpResponse); } }; aPICall.Execute(); }
public void CreateIgloo(Action <bool, SceneLayoutData> callback) { createCallback = callback; SceneLayoutData activeSceneLayoutData = layoutManager.GetActiveSceneLayoutData(); if (activeSceneLayoutData != null) { MutableSceneLayout mutableSceneLayout = new MutableSceneLayout(); SceneLayoutSyncService.ConvertToMutableSceneLayout(mutableSceneLayout, activeSceneLayoutData); eventChannel.AddListener <IglooServiceEvents.IglooLayoutCreated>(onIglooCreated); iglooService.CreateIglooLayout(mutableSceneLayout, this); return; } Log.LogError(this, "Unable to create igloo. Scene layout data not in data model"); if (createCallback != null) { createCallback.InvokeSafe(arg1: false, null); createCallback = null; } }
public void UpdateAndPublishActiveLayout(Action <bool, SceneLayoutData> callback = null) { updateAndPublishCallback = callback; SceneLayoutData activeSceneLayoutData = layoutManager.GetActiveSceneLayoutData(); MutableSceneLayout mutableSceneLayout = new MutableSceneLayout(); SceneLayoutSyncService.ConvertToMutableSceneLayout(mutableSceneLayout, activeSceneLayoutData); IglooVisibility?visibility = null; if (savedIgloosMetaData.IsDirty) { visibility = savedIgloosMetaData.IglooVisibility; } if (updateAndPublishCallback != null) { eventChannel.AddListener <IglooServiceEvents.IglooPublished>(onIglooPublished); } iglooService.UpdateAndPublish(activeSceneLayoutData.LayoutId, visibility, mutableSceneLayout, this); logBIForSavingIglooLayout(activeSceneLayoutData); }
public APICall <UpdateIglooLayoutOperation> UpdateIglooLayout(long sceneLayoutId, MutableSceneLayout sceneLayout) { UpdateIglooLayoutOperation operation = new UpdateIglooLayoutOperation(sceneLayoutId, sceneLayout); return(new APICall <UpdateIglooLayoutOperation>(clubPenguinClient, operation)); }
public APICall <CreateIglooLayoutOperation> CreateIglooLayout(MutableSceneLayout sceneLayout) { CreateIglooLayoutOperation operation = new CreateIglooLayoutOperation(sceneLayout); return(new APICall <CreateIglooLayoutOperation>(clubPenguinClient, operation)); }
public void UpdateAndPublish(long layoutId, IglooVisibility?visibility, MutableSceneLayout sceneLayout, IIglooUpdateAndPublishErrorHandler errorHandler) { IglooUpdateAndPublish iglooUpdateAndPublish = new IglooUpdateAndPublish(this, errorHandler, layoutId, visibility, sceneLayout); iglooUpdateAndPublish.Execute(); }
public CreateIglooLayoutOperation(MutableSceneLayout sceneLayout) { RequestBody = sceneLayout; }
public UpdateIglooLayoutOperation(long sceneLayoutId, MutableSceneLayout sceneLayout) { SceneLayoutId = sceneLayoutId; RequestBody = sceneLayout; }