Esempio n. 1
0
 internal void Attach(CreditsBlock creditsBlock, Vector3 offset)
 {
     base.transform.localPosition          += offset;
     base.transform.localRotation           = Quaternion.Euler(-90f, 180f, 0f);
     GetComponent <Rigidbody>().isKinematic = true;
     base.gameObject.SetActive(value: true);
 }
Esempio n. 2
0
 public void ReinitDoor(bool init)
 {
     if (!NetGame.isClient || init)
     {
         startupDoor.transform.position = Vector3.up * startupDoorY;
         startupDoor.transform.rotation = Quaternion.identity;
     }
     if (!NetGame.isClient)
     {
         for (int i = 0; i < blocks.Count; i++)
         {
             CreditsBlock creditsBlock = blocks[i];
             creditsBlock.transform.position = creditsBlock.lineY * Vector3.up;
             creditsBlock.transform.rotation = Quaternion.identity;
         }
     }
 }
Esempio n. 3
0
 public void ResetState(int checkpoint, int subObjectives)
 {
     if (checkpoint != 0)
     {
         return;
     }
     StartingPlaces(initDoor: false);
     if (!NetGame.isClient)
     {
         for (int i = 0; i < blocks.Count; i++)
         {
             CreditsBlock creditsBlock = blocks[i];
             creditsBlock.DespawnAll();
         }
         CheckScopes();
     }
     UpdateFromState();
 }
Esempio n. 4
0
    public static void InitializePanel()
    {
        GameObject prefab       = (GameObject)Resources.Load("Prefabs/MainMenu/CreditsBlock", typeof(GameObject));
        GameObject CreditsPanel = GameObject.Find("UI/Panels").transform.Find("CreditsPanel").Find("Scroll View/Viewport/Content").gameObject;

        float verticalSpace = -LEGAL_INFO_SIZE;

        foreach (Transform transform in CreditsPanel.transform)
        {
            if (transform.gameObject.name == "CreditsBlock")
            {
                MonoBehaviour.Destroy(transform.gameObject);
            }
        }

        GameObject.Find("UI/Panels").transform.Find("ModsPanel").Find("Scroll View").GetComponentInChildren <ScrollRect>().verticalNormalizedPosition = 0f;

        foreach (var creditsRecord in CreditsData)
        {
            GameObject CreditsBlock;

            CreditsBlock = MonoBehaviour.Instantiate(prefab, CreditsPanel.transform);
            CreditsBlock.transform.localPosition = new Vector3(CreditsBlock.transform.localPosition.x, verticalSpace, CreditsBlock.transform.localPosition.z);
            CreditsBlock.name = "CreditsBlock";

            CreditsBlock.transform.Find("CreditsCategory").GetComponent <Text>().text = creditsRecord.Key;

            Text description = CreditsBlock.transform.Find("CreditsText").GetComponent <Text>();
            description.text = creditsRecord.Value;
            RectTransform descriptionRectTransform = description.GetComponent <RectTransform>();
            descriptionRectTransform.sizeDelta = new Vector2(descriptionRectTransform.sizeDelta.x, description.preferredHeight);

            RectTransform creditsBlockTransform = CreditsBlock.GetComponent <RectTransform>();
            creditsBlockTransform.sizeDelta = new Vector2(creditsBlockTransform.sizeDelta.x, 2 * FREE_SPACE_MEDIUM + description.preferredHeight);

            verticalSpace -= CreditsBlock.GetComponent <RectTransform>().sizeDelta.y + FREE_SPACE_SMALL;
        }

        CreditsPanel.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(0, Mathf.Abs(verticalSpace));
    }
Esempio n. 5
0
    private void ParseContent()
    {
        if (parsed)
        {
            return;
        }
        parsed = true;
        ctext.InitData();
        TextAsset           activeContent = ActiveContent;
        List <CreditsBlock> list          = new List <CreditsBlock>();

        string[] array = activeContent.text.Split('\n');
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = array[i].Trim();
        }
        int   j   = 0;
        float num = 0f;

        while (j < array.Length)
        {
            for (; j < array.Length && string.IsNullOrEmpty(array[j]); j++)
            {
            }
            if (j < array.Length)
            {
                string text = array[j++];
                while (j < array.Length && !string.IsNullOrEmpty(array[j]))
                {
                    text = text + "\r\n" + array[j++];
                }
                CreditsBlock component = UnityEngine.Object.Instantiate(ctext.blockPrefab.gameObject).GetComponent <CreditsBlock>();
                component.transform.SetParent(base.transform, worldPositionStays: false);
                component.transform.position = num * Vector3.up;
                component.Initialize(num, text, ctext);
                blocks.Add(component);
                list.Add(component);
                num -= blockSpacing;
                NetIdentity netIdentity = component.gameObject.AddComponent <NetIdentity>();
                netIdentity.sceneId       = (uint)blocks.Count;
                component.blockId         = netIdentity;
                component.gameObject.name = "CrBlock" + netIdentity.sceneId.ToString();
            }
        }
        startupDoorY = num - showAhead;
        topY         = 0f;
        uint num2 = (uint)NetHost.CalcMaxPossibleSizeForContainerContentsTier0();

        buckets.Clear();
        uint num3 = 288u;
        int  k    = 0;

        for (int count = list.Count; k < count; k++)
        {
            CreditsBlock creditsBlock = list[k];
            int          bitsRequired = creditsBlock.bitsRequired;
            int          count2       = buckets.Count;
            int          num4         = count2 - 1;
            if (num4 < 0 || buckets[num4].bitsLeft < bitsRequired)
            {
                num4++;
            }
            BlockBucket blockBucket;
            if (num4 < count2)
            {
                blockBucket = buckets[num4];
            }
            else
            {
                blockBucket = new BlockBucket();
                buckets.Add(blockBucket);
                if (num3 > 1054)
                {
                    throw new ApplicationException("Run out of auxilliary net ids");
                }
                blockBucket.go                        = new GameObject("LettersScope" + num3.ToString());
                blockBucket.scope                     = blockBucket.go.AddComponent <NetScope>();
                blockBucket.scope.enabled             = false;
                blockBucket.scope.netId               = num3++;
                blockBucket.scope.AllowSuspendCollect = true;
                blockBucket.go.transform.SetParent(base.gameObject.transform, worldPositionStays: false);
                blockBucket.scope.enabled = true;
                blockBucket.bitsLeft      = (int)(num2 * 8) - NetScope.CalculateDeltaPrefixSize(blockBucket.scope.netId);
            }
            blockBucket.blocks.Add(creditsBlock);
            blockBucket.bitsLeft -= bitsRequired;
            creditsBlock.transform.SetParent(blockBucket.go.transform, worldPositionStays: true);
            creditsBlock.bucket = blockBucket;
        }
        int l = 0;

        for (int count3 = buckets.Count; l < count3; l++)
        {
            BlockBucket blockBucket2 = buckets[l];
            blockBucket2.scope.StartNetwork();
        }
        CheckScopes();
    }