private void Start()
    {
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
        OnResize();
    }
    private void GenerateCharacter(bool is_starter)
    {
        int num = 0;

        do
        {
            info = Immigration.Instance.RandomCarePackage();
            num++;
        }while (IsCharacterRedundant() && num < 20);
        if ((UnityEngine.Object)animController != (UnityEngine.Object)null)
        {
            ScreenResize instance = ScreenResize.Instance;
            instance.OnResize = (System.Action)Delegate.Remove(instance.OnResize, new System.Action(OnResize));
            UnityEngine.Object.Destroy(animController.gameObject);
            animController = null;
        }
        SetAnimator();
        SetInfoText();
        selectButton.ClearOnClick();
        if (!controller.IsStarterMinion)
        {
            selectButton.onClick += delegate
            {
                SelectDeliverable();
            };
        }
    }
示例#3
0
    protected override void OnCleanUp()
    {
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Remove(instance.OnResize, new System.Action(RefreshScale));
        base.OnCleanUp();
    }
示例#4
0
    private void GenerateCharacter(bool is_starter, string guaranteedAptitudeID = null)
    {
        int num = 0;

        do
        {
            stats = new MinionStartingStats(is_starter, guaranteedAptitudeID);
            num++;
        }while (IsCharacterRedundant() && num < 20);
        if ((UnityEngine.Object)animController != (UnityEngine.Object)null)
        {
            ScreenResize instance = ScreenResize.Instance;
            instance.OnResize = (System.Action)Delegate.Remove(instance.OnResize, new System.Action(OnResize));
            UnityEngine.Object.Destroy(animController.gameObject);
            animController = null;
        }
        SetAnimator();
        SetInfoText();
        StartCoroutine(SetAttributes());
        selectButton.ClearOnClick();
        if (!controller.IsStarterMinion)
        {
            selectButton.enabled  = true;
            selectButton.onClick += delegate
            {
                SelectDeliverable();
            };
        }
    }
示例#5
0
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        initialAnimScale = UpdateAnimController.animScale;
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(RefreshScale));
    }
示例#6
0
    protected override void OnSpawn()
    {
        FlowMaterial = new Material(Shader.Find("Klei/Flow"));
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
        OnResize();
        DoUpdate(0.1f);
    }
 protected override void OnCmpDisable()
 {
     base.OnCmpDisable();
     if ((UnityEngine.Object)animController != (UnityEngine.Object)null)
     {
         ScreenResize instance = ScreenResize.Instance;
         instance.OnResize = (System.Action)Delegate.Remove(instance.OnResize, new System.Action(OnResize));
         animController.gameObject.DeleteObject();
         animController = null;
     }
 }
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        if (startTransparent)
        {
            StartCoroutine(AlphaIn());
        }
        requiresRefresh = true;
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(RefreshScale));
    }
 public void Generate()
 {
     doWorldGen = !CanLoadSave();
     updateText.gameObject.SetActive(false);
     percentText.gameObject.SetActive(false);
     doWorldGen |= debug;
     if (doWorldGen)
     {
         seedText.text  = string.Format(UI.WORLDGEN.USING_PLAYER_SEED, seed);
         titleText.text = UI.FRONTEND.WORLDGENSCREEN.TITLE.ToString();
         mainText.text  = UI.WORLDGEN.CHOOSEWORLDSIZE.ToString();
         for (int i = 0; i < this.validDimensions.Length; i++)
         {
             GameObject gameObject = UnityEngine.Object.Instantiate(buttonPrefab);
             gameObject.SetActive(true);
             RectTransform component = gameObject.GetComponent <RectTransform>();
             component.SetParent(buttonRoot);
             component.localScale = Vector3.one;
             LocText         componentInChildren = gameObject.GetComponentInChildren <LocText>();
             ValidDimensions validDimensions     = this.validDimensions[i];
             componentInChildren.text = validDimensions.name.ToString();
             int     idx        = i;
             KButton component2 = gameObject.GetComponent <KButton>();
             component2.onClick += delegate
             {
                 DoWorldGen(idx);
                 ToggleGenerationUI();
             };
         }
         if (this.validDimensions.Length == 1)
         {
             DoWorldGen(0);
             ToggleGenerationUI();
         }
         ScreenResize instance = ScreenResize.Instance;
         instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
         OnResize();
     }
     else
     {
         titleText.text = UI.FRONTEND.WORLDGENSCREEN.LOADINGGAME.ToString();
         mainText.gameObject.SetActive(false);
         currentConvertedCurrentStage = UI.WORLDGEN.COMPLETE.key;
         currentPercent = 100f;
         updateText.gameObject.SetActive(false);
         percentText.gameObject.SetActive(false);
         RemoveButtons();
     }
     buttonPrefab.SetActive(false);
 }
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        if (KPlayerPrefs.HasKey(UIScalePrefKey))
        {
            SetUserScale(KPlayerPrefs.GetFloat(UIScalePrefKey) / 100f);
        }
        else
        {
            SetUserScale(1f);
        }
        ScreenResize instance = ScreenResize.Instance;

        instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
    }
 protected override void OnCleanUp()
 {
     base.OnCleanUp();
     if ((UnityEngine.Object)controller != (UnityEngine.Object)null)
     {
         CharacterSelectionController characterSelectionController = controller;
         characterSelectionController.OnLimitReachedEvent = (System.Action)Delegate.Remove(characterSelectionController.OnLimitReachedEvent, new System.Action(OnCharacterSelectionLimitReached));
         CharacterSelectionController characterSelectionController2 = controller;
         characterSelectionController2.OnLimitUnreachedEvent = (System.Action)Delegate.Remove(characterSelectionController2.OnLimitUnreachedEvent, new System.Action(OnCharacterSelectionLimitUnReached));
         CharacterSelectionController characterSelectionController3 = controller;
         characterSelectionController3.OnReshuffleEvent = (Action <bool>)Delegate.Remove(characterSelectionController3.OnReshuffleEvent, new Action <bool>(Reshuffle));
     }
     if ((UnityEngine.Object)animController != (UnityEngine.Object)null)
     {
         ScreenResize instance = ScreenResize.Instance;
         instance.OnResize = (System.Action)Delegate.Remove(instance.OnResize, new System.Action(OnResize));
     }
 }
示例#12
0
    private void SetAnimator()
    {
        if ((UnityEngine.Object)animController == (UnityEngine.Object)null)
        {
            animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("MinionSelectPreview")), contentBody.gameObject, false).GetComponent <KBatchedAnimController>();
            animController.gameObject.SetActive(true);
            KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>();
            animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
            ScreenResize instance = ScreenResize.Instance;
            instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
            Transform transform = animController.transform.parent.gameObject.transform.Find("BG");
            KBatchedAnimController kBatchedAnimController = (!((UnityEngine.Object)transform != (UnityEngine.Object)null)) ? null : transform.gameObject.GetComponent <KBatchedAnimController>();
            if ((UnityEngine.Object)kBatchedAnimController != (UnityEngine.Object)null)
            {
                kBatchedAnimController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
            }
        }
        stats.ApplyTraits(animController.gameObject);
        stats.ApplyRace(animController.gameObject);
        stats.ApplyAccessories(animController.gameObject);
        stats.ApplyExperience(animController.gameObject);
        HashedString name = idleAnims[UnityEngine.Random.Range(0, idleAnims.Length)];

        idle_anim = Assets.GetAnim(name);
        if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null)
        {
            animController.AddAnimOverrides(idle_anim, 0f);
        }
        HashedString name2 = new HashedString("crewSelect_fx_kanim");
        KAnimFile    anim  = Assets.GetAnim(name2);

        if ((UnityEngine.Object)anim != (UnityEngine.Object)null)
        {
            animController.AddAnimOverrides(anim, 0f);
        }
        animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f);
    }
示例#13
0
 private void Awake()
 {
     Instance     = this;
     isFullscreen = Screen.fullScreen;
     OnResize     = (System.Action)Delegate.Combine(OnResize, new System.Action(SaveResolutionToPrefs));
 }
示例#14
0
 void Awake()
 {
     instance = this;
 }
示例#15
0
 private void SetPortraitAnimator(IAssignableIdentity identity)
 {
     if (identity != null && !identity.IsNull())
     {
         if ((UnityEngine.Object)animController == (UnityEngine.Object)null)
         {
             animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("FullMinionUIPortrait")), duplicantAnimAnchor.gameObject, false).GetComponent <KBatchedAnimController>();
             animController.gameObject.SetActive(true);
             KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>();
             animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
             ScreenResize instance = ScreenResize.Instance;
             instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
         }
         string       value     = string.Empty;
         Accessorizer component = animController.GetComponent <Accessorizer>();
         for (int num = component.GetAccessories().Count - 1; num >= 0; num--)
         {
             component.RemoveAccessory(component.GetAccessories()[num].Get());
         }
         MinionIdentity       minionIdentity       = identity as MinionIdentity;
         StoredMinionIdentity storedMinionIdentity = identity as StoredMinionIdentity;
         Accessorizer         accessorizer         = null;
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             accessorizer = minionIdentity.GetComponent <Accessorizer>();
             foreach (ResourceRef <Accessory> accessory in accessorizer.GetAccessories())
             {
                 component.AddAccessory(accessory.Get());
             }
             value = minionIdentity.GetComponent <MinionResume>().CurrentHat;
         }
         else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
         {
             foreach (ResourceRef <Accessory> accessory2 in storedMinionIdentity.accessories)
             {
                 component.AddAccessory(accessory2.Get());
             }
             value = storedMinionIdentity.currentHat;
         }
         HashedString name = "anim_idle_healthy_kanim";
         idle_anim = Assets.GetAnim(name);
         if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null)
         {
             animController.AddAnimOverrides(idle_anim, 0f);
         }
         animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f);
         AccessorySlot hat = Db.Get().AccessorySlots.Hat;
         animController.SetSymbolVisiblity(hat.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false);
         animController.SetSymbolVisiblity(Db.Get().AccessorySlots.Hair.targetSymbolId, string.IsNullOrEmpty(value) ? true : false);
         animController.SetSymbolVisiblity(Db.Get().AccessorySlots.HatHair.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false);
         KAnim.Build.Symbol source_symbol  = null;
         KAnim.Build.Symbol source_symbol2 = null;
         if ((bool)accessorizer)
         {
             source_symbol  = accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol;
             source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol;
         }
         else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
         {
             source_symbol  = storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol;
             source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol;
         }
         animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HairAlways.targetSymbolId, source_symbol, 1);
         animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HatHair.targetSymbolId, source_symbol2, 1);
     }
 }