예제 #1
0
 public void SetupPlatform(string platformStr, bool value)
 {
     try
     {
         RenderPlatforms platform = (RenderPlatforms)Enum.Parse(typeof(RenderPlatforms), platformStr);
         int             index    = -1;
         if (RenderingPlatformOpHelper.PlatformToIndex.TryGetValue(platform, out index))
         {
             m_renderingPlatforms[index] = value;
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }
예제 #2
0
        public void ReadFromString(ref uint index, ref string[] nodeParams)
        {
            if (UIUtils.CurrentShaderVersion() < 17006)
            {
                for (int i = 0; i < m_renderingPlatformValues.Length; i++)
                {
                    m_renderingPlatformValues[i] = false;
                }

                int count       = LegacyIndexToPlatform.Count;
                int activeCount = 0;
                for (int i = 0; i < count; i++)
                {
                    RenderPlatforms platform = LegacyIndexToPlatform[i];
                    int             newIndex = PlatformToIndex[platform];
                    bool            value    = Convert.ToBoolean(nodeParams[index++]);
                    if (value)
                    {
                        m_renderingPlatformValues[newIndex] = true;
                        activeCount += 1;
                    }
                    else
                    {
                        m_renderingPlatformValues[newIndex] = false;
                    }
                }

                if (activeCount == count)
                {
                    m_renderingPlatformValues[PlatformToIndex[RenderPlatforms.vulkan]] = true;
                }
            }
            else
            {
                int count = Convert.ToInt32(nodeParams[index++]);
                if (count > 0)
                {
                    RenderPlatforms firstPlatform = (RenderPlatforms)Enum.Parse(typeof(RenderPlatforms), nodeParams[index++]);
                    if (firstPlatform == RenderPlatforms.all)
                    {
                        for (int i = 0; i < m_renderingPlatformValues.Length; i++)
                        {
                            m_renderingPlatformValues[i] = true;
                        }
                    }
                    else
                    {
                        for (int i = 0; i < m_renderingPlatformValues.Length; i++)
                        {
                            m_renderingPlatformValues[i] = false;
                        }

                        m_renderingPlatformValues[PlatformToIndex[firstPlatform]] = true;
                        for (int i = 1; i < count; i++)
                        {
                            RenderPlatforms currPlatform = (RenderPlatforms)Enum.Parse(typeof(RenderPlatforms), nodeParams[index++]);
                            m_renderingPlatformValues[PlatformToIndex[currPlatform]] = true;
                        }
                    }
                }
            }
        }