예제 #1
0
        private static bool pickBackgroundImage(string path)
        {
            if (!Directory.Exists(path))
            {
                LoadingUI.loadBackgroundImage(null);
                return(false);
            }
            string[] files  = Directory.GetFiles(path, "*.png");
            string[] files2 = Directory.GetFiles(path, "*.jpg");
            string[] array  = new string[files.Length + files2.Length];
            int      num    = 0;

            for (int i = 0; i < files.Length; i++)
            {
                array[num] = files[i];
                num++;
            }
            for (int j = 0; j < files2.Length; j++)
            {
                array[num] = files2[j];
                num++;
            }
            if (array.Length == 0)
            {
                LoadingUI.loadBackgroundImage(null);
            }
            else
            {
                int    num2  = Random.Range(0, array.Length);
                string path2 = array[num2];
                LoadingUI.loadBackgroundImage(path2);
            }
            return(true);
        }
예제 #2
0
        public static void updateScene()
        {
            if (!Dedicator.isDedicated)
            {
                if (LoadingUI.backgroundImage == null)
                {
                    return;
                }
                if (LoadingUI.loadingImage == null)
                {
                    return;
                }
                LoadingUI.updateProgress(0f);
                Local local = Localization.read("/Menu/MenuTips.dat");
                byte  b;
                do
                {
                    b = (byte)Random.Range(1, (int)(LoadingUI.TIP_COUNT + 1));
                }while (b == (byte)LoadingUI.tip);
                LoadingUI.tip = (ELoadingTip)b;
                string text;
                if (OptionsSettings.streamer && Provider.streamerNames != null && Provider.streamerNames.Count > 0 && Provider.streamerNames[0] == "Nelson AI")
                {
                    text = local.format("Streamer");
                }
                else
                {
                    switch (LoadingUI.tip)
                    {
                    case ELoadingTip.HOTKEY:
                        text = local.format("Hotkey");
                        break;

                    case ELoadingTip.EQUIP:
                        text = local.format("Equip", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.DROP:
                        text = local.format("Drop", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.SIRENS:
                        text = local.format("Sirens", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.TRANSFORM:
                        text = local.format("Transform");
                        break;

                    case ELoadingTip.QUALITY:
                        text = local.format("Quality");
                        break;

                    case ELoadingTip.UMBRELLA:
                        text = local.format("Umbrella");
                        break;

                    case ELoadingTip.HEAL:
                        text = local.format("Heal");
                        break;

                    case ELoadingTip.ROTATE:
                        text = local.format("Rotate");
                        break;

                    case ELoadingTip.BASE:
                        text = local.format("Base");
                        break;

                    case ELoadingTip.DEQUIP:
                        text = local.format("Dequip", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.dequip)
                        });
                        break;

                    case ELoadingTip.NIGHTVISION:
                        text = local.format("Nightvision", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.vision)
                        });
                        break;

                    case ELoadingTip.TRANSFER:
                        text = local.format("Transfer", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.SURFACE:
                        text = local.format("Surface", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.jump)
                        });
                        break;

                    case ELoadingTip.ARREST:
                        text = local.format("Arrest", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.leanLeft),
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.leanRight)
                        });
                        break;

                    case ELoadingTip.SAFEZONE:
                        text = local.format("Safezone");
                        break;

                    case ELoadingTip.CLAIM:
                        text = local.format("Claim");
                        break;

                    case ELoadingTip.GROUP:
                        text = local.format("Group");
                        break;

                    case ELoadingTip.MAP:
                        text = local.format("Map", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.map)
                        });
                        break;

                    case ELoadingTip.BEACON:
                        text = local.format("Beacon");
                        break;

                    case ELoadingTip.HORN:
                        text = local.format("Horn", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.primary)
                        });
                        break;

                    case ELoadingTip.LIGHTS:
                        text = local.format("Lights", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.secondary)
                        });
                        break;

                    case ELoadingTip.SNAP:
                        text = local.format("Snap", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.snap)
                        });
                        break;

                    case ELoadingTip.UPGRADE:
                        text = local.format("Upgrade", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.GRAB:
                        text = local.format("Grab", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.SKYCRANE:
                        text = local.format("Skycrane", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.other)
                        });
                        break;

                    case ELoadingTip.SEAT:
                        text = local.format("Seat");
                        break;

                    case ELoadingTip.RARITY:
                        text = local.format("Rarity");
                        break;

                    case ELoadingTip.ORIENTATION:
                        text = local.format("Orientation", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.rotate)
                        });
                        break;

                    case ELoadingTip.RED:
                        text = local.format("Red");
                        break;

                    case ELoadingTip.STEADY:
                        text = local.format("Steady", new object[]
                        {
                            MenuConfigurationControlsUI.getKeyCodeText(ControlsSettings.sprint)
                        });
                        break;

                    default:
                        text = "#" + LoadingUI.tip.ToString();
                        break;
                    }
                }
                LoadingUI.tipBox.text = ItemTool.filterRarityRichText(local.format("Tip", new object[]
                {
                    text
                }));
                if (Level.info != null)
                {
                    if (!LoadingUI.pickBackgroundImage(Level.info.path + "/Screenshots") && !LoadingUI.loadBackgroundImage(Level.info.path + "/Level.png"))
                    {
                        LoadingUI.pickBackgroundImage(ReadWrite.PATH + "/Screenshots");
                    }
                    Local local2 = Localization.tryRead(Level.info.path, false);
                    if (local2 != null)
                    {
                        if (Provider.isConnected)
                        {
                            string text2;
                            if (Provider.isServer)
                            {
                                text2 = LoadingUI.localization.format("Offline");
                            }
                            else
                            {
                                if (Provider.currentServerInfo.IsVACSecure)
                                {
                                    text2 = LoadingUI.localization.format("VAC_Secure");
                                }
                                else
                                {
                                    text2 = LoadingUI.localization.format("VAC_Insecure");
                                }
                                if (Provider.currentServerInfo.IsBattlEyeSecure)
                                {
                                    text2 = text2 + " + " + LoadingUI.localization.format("BattlEye_Secure");
                                }
                                else
                                {
                                    text2 = text2 + " + " + LoadingUI.localization.format("BattlEye_Insecure");
                                }
                            }
                            LoadingUI.loadingLabel.text = local2.format("Loading_Server", new object[]
                            {
                                (!OptionsSettings.streamer) ? Provider.currentServerInfo.name : LoadingUI.localization.format("Streamer"),
                                text2
                            });
                            if (Provider.mode == EGameMode.EASY)
                            {
                                LoadingUI.loadingImage.backgroundColor = Palette.COLOR_G;
                                LoadingUI.loadingImage.foregroundColor = Palette.COLOR_G;
                            }
                            else if (Provider.mode == EGameMode.HARD)
                            {
                                LoadingUI.loadingImage.backgroundColor = Palette.COLOR_R;
                                LoadingUI.loadingImage.foregroundColor = Palette.COLOR_R;
                            }
                            else
                            {
                                LoadingUI.loadingImage.backgroundColor = Color.white;
                                LoadingUI.loadingImage.foregroundColor = Color.white;
                            }
                        }
                        else
                        {
                            LoadingUI.loadingLabel.text            = local2.format("Loading_Editor");
                            LoadingUI.loadingImage.backgroundColor = Color.white;
                            LoadingUI.loadingImage.foregroundColor = Color.white;
                        }
                    }
                    else
                    {
                        LoadingUI.loadingLabel.text            = string.Empty;
                        LoadingUI.loadingImage.backgroundColor = Color.white;
                        LoadingUI.loadingImage.foregroundColor = Color.white;
                    }
                    if (Level.info.configData.Creators.Length > 0 || Level.info.configData.Collaborators.Length > 0 || Level.info.configData.Thanks.Length > 0)
                    {
                        int    num   = 0;
                        string text3 = string.Empty;
                        if (Level.info.configData.Creators.Length > 0)
                        {
                            text3 += LoadingUI.localization.format("Creators");
                            num   += 15;
                            for (int i = 0; i < Level.info.configData.Creators.Length; i++)
                            {
                                text3 = text3 + "\n" + Level.info.configData.Creators[i];
                                num  += 15;
                            }
                        }
                        if (Level.info.configData.Collaborators.Length > 0)
                        {
                            if (text3.Length > 0)
                            {
                                text3 += "\n\n";
                                num   += 30;
                            }
                            text3 += LoadingUI.localization.format("Collaborators");
                            num   += 15;
                            for (int j = 0; j < Level.info.configData.Collaborators.Length; j++)
                            {
                                text3 = text3 + "\n" + Level.info.configData.Collaborators[j];
                                num  += 15;
                            }
                        }
                        if (Level.info.configData.Thanks.Length > 0)
                        {
                            if (text3.Length > 0)
                            {
                                text3 += "\n\n";
                                num   += 30;
                            }
                            text3 += LoadingUI.localization.format("Thanks");
                            num   += 15;
                            for (int k = 0; k < Level.info.configData.Thanks.Length; k++)
                            {
                                text3 = text3 + "\n" + Level.info.configData.Thanks[k];
                                num  += 15;
                            }
                        }
                        LoadingUI.creditsBox.positionOffset_Y = -num / 2;
                        LoadingUI.creditsBox.sizeOffset_Y     = num;
                        LoadingUI.creditsBox.text             = text3;
                        LoadingUI.creditsBox.isVisible        = true;
                    }
                    else
                    {
                        LoadingUI.creditsBox.isVisible = false;
                    }
                }
                else
                {
                    LoadingUI.pickBackgroundImage(ReadWrite.PATH + "/Screenshots");
                    LoadingUI.loadingLabel.text            = LoadingUI.localization.format("Loading");
                    LoadingUI.loadingImage.backgroundColor = Color.white;
                    LoadingUI.loadingImage.foregroundColor = Color.white;
                    LoadingUI.creditsBox.isVisible         = false;
                }
                LoadingUI.loadingBox.sizeOffset_X = -20;
                LoadingUI.cancelButton.isVisible  = false;
            }
        }