Пример #1
0
 public static NetworkIndicators Get()
 {
     if (_instance == null)
     {
         _instance = new NetworkIndicators();
     }
     return(_instance);
 }
Пример #2
0
        private void DoTopBar(Rect rect, float height)
        {
            _spinner.OnDoWindowContents();

            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(0, 0, rect.width / 2, height), "ModSync.UpdateMods".Translate().ToUpper());
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(0, 30f, rect.width / 2, height - 30f), "ModSync.ShowingActiveMods".Translate().ToUpper());
            //CurrSyncState = CurrentSyncState.ModSyncError;
            if (CurrSyncState == CurrentSyncState.ClientOffline || CurrSyncState == CurrentSyncState.ModSyncOffline)
            {
                PlaceConnectionStatusBar(new Rect(rect.width / 2f, 0, rect.width / 2f, height),
                                         CurrSyncState == CurrentSyncState.ClientOffline
                        ? " " + "ModSync.YouAreOffline".Translate()
                        : " " + "ModSync.CantConnectToModSync".Translate(),
                                         NetworkIndicators.Get().Offline);
            }
            else if (CurrSyncState == CurrentSyncState.ModSyncError)
            {
                PlaceConnectionStatusBar(new Rect(rect.width / 2f, 0, rect.width / 2f, height), "ModSync.UnknwonError".Translate(), NetworkIndicators.Get().Error);

                TooltipHandler.TipRegion(new Rect(rect.width / 2f, 0, rect.width / 2f, height), new TipSignal("Error processing request: " + _errorCode + "\nPlease try again.\nIf this problem persists, open the game logger and find the error with your request and response to the server.\nUpload the details to us on the forums!", "error".GetHashCode() * 3311));
                //PlaceConnectionStatusBar(new Rect(rect.width / 2f, 0, rect.width / 2f, height), " We are live! ", NetworkIndicators.Get().Synced);
            }
            else if (CurrSyncState == CurrentSyncState.RequestStarted)
            {
                PlaceConnectionStatusBar(new Rect(rect.width / 2f, 0, rect.width / 2f, height), "ModSync.PleaseWait".Translate() + " " + _spinner.GetSpinnerDots(), NetworkIndicators.Get().Working);
            }
            else if (CurrSyncState == CurrentSyncState.Done)
            {
                PlaceConnectionStatusBar(new Rect(rect.width / 2f, 0, rect.width / 2f, height), "ModSync.Synced".Translate(), NetworkIndicators.Get().Synced);
            }
        }