protected override bool Changed()
 {
     if (!VCUtils.VectorApproximate(m_PositionInput.Vector, m_Data.m_Position, m_PositionInput.m_Format))
     {
         return(true);
     }
     if (m_VisibleCheck.isChecked != m_Data.m_Visible)
     {
         return(true);
     }
     if (m_Phase0Check.isChecked != ((m_Data.m_Phase & 1) == 0))
     {
         return(true);
     }
     if (m_Phase1Check.isChecked != ((m_Data.m_Phase & 1) == 1))
     {
         return(true);
     }
     if (m_SmallBigCheck.isChecked != ((m_Data.m_Phase & 2) == 2))
     {
         return(true);
     }
     if (m_MotorCheck.isChecked != ((m_Data.m_Phase & 4) != 4))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
    private static void LoadEditorScenes()
    {
        s_EditorScenes = new List <VCESceneSetting> ();
#if PLANET_EXPLORERS
        SqliteDataReader reader = LocalDatabase.Instance.ExecuteQuery("SELECT * FROM vc_scene");
        while (reader.Read())
        {
            VCESceneSetting scene = new VCESceneSetting();
            scene.m_Id       = Convert.ToInt32(reader.GetString(reader.GetOrdinal("id")));
            scene.m_ParentId = Convert.ToInt32(reader.GetString(reader.GetOrdinal("parentid")));
            scene.m_Name     = reader.GetString(reader.GetOrdinal("name"));
            scene.m_Category = (EVCCategory)(Convert.ToInt32(reader.GetString(reader.GetOrdinal("category"))));
            List <string> parts = null;
            parts = VCUtils.ExplodeString(reader.GetString(reader.GetOrdinal("editorsize")), ';');
            scene.m_EditorSize   = new IntVector3();
            scene.m_EditorSize.x = Convert.ToInt32(parts[0]);
            scene.m_EditorSize.y = Convert.ToInt32(parts[1]);
            scene.m_EditorSize.z = Convert.ToInt32(parts[2]);
            parts.Clear();
            scene.m_VoxelSize     = Convert.ToSingle(reader.GetString(reader.GetOrdinal("voxelsize")));
            parts                 = VCUtils.ExplodeString(reader.GetString(reader.GetOrdinal("interval")), ';');
            scene.m_MajorInterval = Convert.ToInt32(parts[0]);
            scene.m_MinorInterval = Convert.ToInt32(parts[1]);
            parts.Clear();
            parts             = VCUtils.ExplodeString(reader.GetString(reader.GetOrdinal("cost")), ';');
            scene.m_BlockUnit = Convert.ToInt32(parts[0]);
            scene.m_DyeUnit   = Convert.ToInt32(parts[1]);
            parts.Clear();
            s_EditorScenes.Add(scene);
        }
#endif
    }
Esempio n. 3
0
 protected override bool Init()
 {
     if (!VCPluginSettings.EzguiEnabled(base.gameObject))
     {
         return(false);
     }
     if (!base.Init())
     {
         return(false);
     }
     if (this.colliderObject == this.movingPart)
     {
         LogSystem.LogWarning(new object[]
         {
             "VCAnalogJoystickEzgui may not behave properly when the colliderObject is the same as the movingPart! ",
             "You should add a Collider to a gameObject independent from the EZGUI UI components."
         });
     }
     this._movingPartBehaviorComponent = this.GetEzguiBehavior(this.movingPart);
     if (this._movingPartBehaviorComponent == null)
     {
         VCUtils.DestroyWithError(base.gameObject, "Cannot find a SimpleSprite or UIButton component on movingPart.  Destroying this control.");
         return(false);
     }
     if (this._collider == null)
     {
         VCUtils.DestroyWithError(base.gameObject, "No collider attached to colliderGameObject!  Destroying this control.");
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
    protected override bool Init()
    {
        // make sure fake classes aren't defined
        if (!VCPluginSettings.NguiEnabled(gameObject))
        {
            return(false);
        }

        if (!base.Init())
        {
            return(false);
        }

        // we require a collider
        if (_collider == null)
        {
            VCUtils.DestroyWithError(gameObject, "No collider attached to colliderGameObject!  Destroying this gameObject.");
            return(false);
        }

        _movingPartSprite = movingPart.GetComponent <UISprite>();
        if (_movingPartSprite == null)
        {
            _movingPartSprite = movingPart.GetComponentInChildren <UISprite>();
        }

        return(true);
    }
Esempio n. 5
0
    protected override bool Changed()
    {
        if (!VCUtils.VectorApproximate(m_PositionInput.Vector, m_Data.m_Position, m_PositionInput.m_Format))
        {
            return(true);
        }
        if (!VCUtils.VectorApproximate(m_RotationInput.Vector, m_Data.m_Rotation, m_RotationInput.m_Format))
        {
            return(true);
        }
        if (!VCUtils.VectorApproximate(m_ScaleInput.Vector, m_Data.m_Scale, m_ScaleInput.m_Format))
        {
            return(true);
        }
        Color32 insc  = m_ColorPicker.FinalColor;
        Color32 datac = m_Data.m_Color;

        if (insc.r != datac.r)
        {
            return(true);
        }
        if (insc.g != datac.g)
        {
            return(true);
        }
        if (insc.b != datac.b)
        {
            return(true);
        }
        if (m_VisibleCheck.isChecked != m_Data.m_Visible)
        {
            return(true);
        }
        return(false);
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
#if PLANET_EXPLORERS
        ItemSample item = new ItemSample(m_GameItemId);
        if (item.protoData == null)
        {
            return;
        }

        m_IconSprite.spriteName = item.iconString0;

        //ItemAsset.ItemData item = ItemAsset.ItemData.s_tblItemData.Find(iter => iter.m_ID == m_GameItemId);
        //m_IconSprite.spriteName = item.m_Icon.Split(',')[0];
        m_NameLabel.text = VCUtils.Capital(item.nameText, true);
        //if ( PlayerFactory.mMainPlayer != null )
        if (PeCreature.Instance.mainPlayer != null)
        {
            if (VCEditor.Instance.m_CheatWhenMakeCreation)
            {
                m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Cheat".ToLocalizationString() + "[-]";
                m_IsEnough        = true;
            }
            else if (Pathea.PeGameMgr.IsSingleBuild)
            {
                m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Build".ToLocalizationString() + "[-]";
                m_IsEnough        = true;
            }
            else if (PeGameMgr.playerType == PeGameMgr.EPlayerType.Tutorial)
            {
                m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Tutorial".ToLocalizationString() + "[-]";
                m_IsEnough        = true;
            }
            else
            {
                Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>();
                int have = pkg.package.GetCount(m_GameItemId);
                if (have >= m_GameItemCost)
                {
                    m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + have.ToString("#,##0").Trim() + "[-]";
                    m_IsEnough        = true;
                }
                else
                {
                    m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [FF0000]" + have.ToString("#,##0").Trim() + "[-]";
                    m_IsEnough        = false;
                }
            }
        }
        else
        {
            m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim();
            m_IsEnough        = false;
        }
#else
        m_IconSprite.spriteName = "";
        m_NameLabel.text        = m_GameItemId.ToString();
        m_CountLabel.text       = m_GameItemCost.ToString("# ##0");
        m_IsEnough = false;
#endif
    }
Esempio n. 7
0
 protected void InitGameObjects()
 {
     if (this.upStateObject == null && this.pressedStateObject == null)
     {
         LogSystem.LogWarning(new object[]
         {
             "No up or pressed state GameObjects specified! Setting upStateObject to this.gameObject."
         });
         this.upStateObject = base.gameObject;
     }
     if (this.colliderObject == null)
     {
         GameObject arg_73_1;
         if ((arg_73_1 = this.upStateObject) == null)
         {
             arg_73_1 = (this.pressedStateObject ?? base.gameObject);
         }
         this.colliderObject = arg_73_1;
     }
     base.InitCollider(this.colliderObject);
     if (this._requireCollider && this._collider == null)
     {
         VCUtils.DestroyWithError(base.gameObject, "colliderObject must have a Collider component!  Destroying this control.");
         return;
     }
 }
Esempio n. 8
0
    private void PostGenerate(MeshFilter mf)
    {
        if (m_ForEditor)
        {
            m_MeshMgr.m_ColliderDirty = true;
        }
        else
        {
            if (m_CreateBoxCollider)
            {
                BoxCollider bc = mf.gameObject.GetComponent <BoxCollider>();
                if (bc != null)
                {
                    BoxCollider.DestroyImmediate(bc);
                }

                RecalcCreationMeshBounds(mf.mesh);
                bc = mf.gameObject.AddComponent <BoxCollider>();

                bc.size    *= WhiteCat.PEVCConfig.instance.creationColliderScale;
                bc.material = WhiteCat.PEVCConfig.instance.physicMaterial;
            }

            // particle
            VCParticlePlayer pp = mf.GetComponent <VCParticlePlayer>();
            pp.LocalPosition = VCUtils.RandPosInBoundingBox(mf.mesh.bounds);
        }

        var cc = mf.GetComponentInParent <WhiteCat.CreationController>();

        if (cc)
        {
            cc.OnNewMeshBuild(mf);
        }
    }
Esempio n. 9
0
    internal static void OnFileSharedEvent(object sender, EventArgs args)
    {
        SteamFileItem item = (SteamFileItem)sender;

        if (!item._SendToServer)
        {
            return;
        }
        if (null != PlayerNetwork.mainPlayer)
        {
            VCIsoData da = new VCIsoData();
            da.Import(item._Data, new VCIsoOption(false));
            var components = from component in da.m_Components
                             where VCUtils.IsSeat(component.m_Type)
                             select(int) component.m_Type;
            if (components.Count() > 0)
            {
                NetworkManager.SyncServer(EPacketType.PT_Common_WorkshopShared, item.FileID, item.RealFileName, item.HashCode, item._free, item.instanceId, true, components.ToArray());
            }
            else
            {
                NetworkManager.SyncServer(EPacketType.PT_Common_WorkshopShared, item.FileID, item.RealFileName, item.HashCode, item._free, item.instanceId, false);
            }
        }


        string fielName = VCConfig.s_CreationNetCachePath + item.HashCode.ToString("X").PadLeft(16, '0') + VCConfig.s_CreationNetCacheFileExt;

        using (FileStream fs = new FileStream(fielName, FileMode.Create, FileAccess.Write, FileShare.Read))
        {
            fs.Write(item._Data, 0, item._Data.Length);
        }

        _SteamItems[item.HashCode] = item.FileName;
    }
Esempio n. 10
0
 private void InitMatterList()
 {
     m_MatterUI.items.Clear();
     foreach (KeyValuePair <int, VCMatterInfo> kvp in VCConfig.s_Matters)
     {
         m_MatterUI.items.Add(VCUtils.Capital(kvp.Value.Name, true).ToLocalizationString());
     }
 }
Esempio n. 11
0
 public static bool EzguiEnabled(GameObject go)
 {
     if (typeof(SpriteRoot).GetMember("fakeMember").Length == 0)
     {
         return(true);
     }
     VCUtils.DestroyWithError(go, "An EZGUI Virtual Control is being used, but EZGUI is not properly enabled!\nIn order to use EZGUI, open VCPluginSettings.cs and edit line 63 to #if false.\nSee that file for further instruction.  Destroying this control.");
     return(false);
 }
Esempio n. 12
0
 public void MaterialListFocusOnSelected()
 {
     m_TempSelected = VCEditor.SelectedMaterial;
     if (m_MatterPopupList.selection != "All".ToLocalizationString() && VCEditor.SelectedMaterial != null)
     {
         m_MatterPopupList.selection = VCUtils.Capital(VCConfig.s_Matters[VCEditor.SelectedMaterial.m_MatterId].Name, true);
     }
     Invoke("MaterialListFocusOnSelectedInvoke", 0.2f);
 }
Esempio n. 13
0
 void ValidateVector()
 {
     m_Vector   = VCUtils.ClampInBound(m_Vector, ValueBound);
     m_Vector  *= 2;
     m_Vector.x = Mathf.Round(m_Vector.x);
     m_Vector.y = Mathf.Round(m_Vector.y);
     m_Vector.z = Mathf.Round(m_Vector.z);
     m_Vector  *= 0.5f;
 }
    // initializes the object
    protected virtual bool Init()
    {
        // don't execute OnGUI behavior, for performance
        this.useGUILayout = false;

        #region error checking
        // make sure we have a VCTouchController
        if (VCTouchController.Instance == null)
        {
            Debug.LogWarning("Cannot find VCTouchController!\nVirtualControls requires a gameObject which has VCTouchController component attached in scene. Adding one for you...");
            //gameObject.AddComponent<VCTouchController>();
            VCUtils.AddTouchController(gameObject);
        }

        // make sure the movingPart is specified
        if (!movingPart)
        {
            VCUtils.DestroyWithError(gameObject, "movingPart is null, VCAnalogJoystick requires it to be assigned to a gameObject! Destroying this control.");
            return(false);
        }

        // make sure rangeX is positive
        if (this.RangeX <= 0.0f)
        {
            VCUtils.DestroyWithError(gameObject, "rangeMin must be less than rangeMax!  Destroying this control.");
            return(false);
        }

        // make sure rangeY is positive
        if (this.RangeY <= 0.0f)
        {
            VCUtils.DestroyWithError(gameObject, "rangeMin must be less than rangeMax!  Destroying this control.");
            return(false);
        }
        #endregion

        if (basePart == null)
        {
            basePart = this.gameObject;
        }

        if (colliderObject == null)
        {
            colliderObject = movingPart;
        }

        _deltaPixels             = new Vector2();
        _dragDeltaMagnitudeMaxSq = dragDeltaMagnitudeMaxPixels * dragDeltaMagnitudeMaxPixels;

        InitCollider(colliderObject);
        InitOriginValues();
        TapCount = 0;

        AddInstance();

        return(true);
    }
Esempio n. 15
0
 public void InitMatterList()
 {
     m_MatterPopupList.items.Clear();
     m_MatterPopupList.items.Add("All".ToLocalizationString());
     foreach (KeyValuePair <int, VCMatterInfo> kvp in VCConfig.s_Matters)
     {
         m_MatterPopupList.items.Add(VCUtils.Capital(kvp.Value.Name, true).ToLocalizationString());
     }
     m_MatterPopupList.selection = "All".ToLocalizationString();
 }
Esempio n. 16
0
    // Use this for initialization
    void Start()
    {
        m_Anim = GetComponent <Animator>();
        PeEntity monoEntity = VCUtils.GetComponentOrOnParent <PeEntity>(gameObject);

        if (null != monoEntity)
        {
            m_AnimCmpt = monoEntity.GetCmpt <AnimatorCmpt>();
        }
    }
Esempio n. 17
0
    public void DeleteSelection()
    {
        m_Action = new VCEAction();

        VCEditor.s_Mirror.CalcPrepare(VCEditor.s_Scene.m_Setting.m_VoxelSize);
        foreach (KeyValuePair <int, byte> kvp in m_SelectionMgr.m_Selection)
        {
            // Mirror
            if (VCEditor.s_Mirror.Enabled_Masked)
            {
                IntVector3 pos = VCIsoData.KeyToIPos(kvp.Key);
                VCEditor.s_Mirror.MirrorVoxel(pos);
                float strength = (float)(kvp.Value) / 255.0f;
                for (int i = 0; i < VCEditor.s_Mirror.OutputCnt; ++i)
                {
                    if (VCEditor.s_Scene.m_IsoData.IsPointIn(VCEditor.s_Mirror.Output[i]))
                    {
                        int     voxel_pos = VCIsoData.IPosToKey(VCEditor.s_Mirror.Output[i]);
                        VCVoxel old_voxel = VCEditor.s_Scene.m_IsoData.GetVoxel(voxel_pos);
                        VCVoxel new_voxel = old_voxel;
                        new_voxel.VolumeF = new_voxel.VolumeF * (1 - strength);
                        if (old_voxel != new_voxel)
                        {
                            VCEAlterVoxel modify = new VCEAlterVoxel(voxel_pos, old_voxel, new_voxel);
                            modify.Redo();
                            m_Action.Modifies.Add(modify);
                        }
                    }
                }
            }
            // No mirror
            else
            {
                float   strength  = (float)(kvp.Value) / 255.0f;
                int     voxel_pos = kvp.Key;
                VCVoxel old_voxel = VCEditor.s_Scene.m_IsoData.GetVoxel(voxel_pos);
                VCVoxel new_voxel = old_voxel;
                new_voxel.VolumeF = new_voxel.VolumeF * (1 - strength);
                if (old_voxel != new_voxel)
                {
                    VCEAlterVoxel modify = new VCEAlterVoxel(voxel_pos, old_voxel, new_voxel);
                    m_Action.Modifies.Add(modify);
                }
            }
        }
        ColorSelection(VCIsoData.BLANK_COLOR, false, true);
        if (m_Action.Modifies.Count > 0)
        {
            m_Action.DoButNotRegister();
            VCUtils.ISOCut(VCEditor.s_Scene.m_IsoData, m_Action);
            m_Action.Register();
            VCEStatusBar.ShowText("Selected voxels have been removed".ToLocalizationString(), 2);
        }
        ClearSelection();
    }
Esempio n. 18
0
    protected override bool Colliding(VCTouchWrapper tw)
    {
        if (this._collider != null)
        {
            return(base.AABBContains(tw.position));
        }
        Rect screenRect = this._colliderGuiTexture.GetScreenRect();

        VCUtils.ScaleRect(ref screenRect, this.hitRectScale);
        return(screenRect.Contains(tw.position));
    }
Esempio n. 19
0
 protected override bool Changed()
 {
     if (!VCUtils.VectorApproximate(m_PositionInput.Vector, m_Data.m_Position, m_PositionInput.m_Format))
     {
         return(true);
     }
     if (m_VisibleCheck.isChecked != m_Data.m_Visible)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 20
0
 public void UpdateUI()
 {
     m_ColorRect.color        = m_FinalColor;
     m_HSCircle.localPosition = new Vector3(m_Hue / 360, m_Sat, 0);
     m_BrtSlider.sliderValue  = m_Brt;
     m_BrtSliderColor.color   = VCUtils.HSB2RGB(m_Hue, m_Sat, 1);
     m_RSlider.sliderValue    = m_FinalColor.r;
     m_GSlider.sliderValue    = m_FinalColor.g;
     m_BSlider.sliderValue    = m_FinalColor.b;
     m_RValLabel.text         = (m_FinalColor.r * 100).ToString("0") + "%";
     m_GValLabel.text         = (m_FinalColor.g * 100).ToString("0") + "%";
     m_BValLabel.text         = (m_FinalColor.b * 100).ToString("0") + "%";
 }
    // not implemented as they aren't very popular,
    // uncomment here and in Update() if you want to use

    //public float magnitudeSqr;
    //public float angleRadians;
    //public float angleDegrees;
    #endregion

    void Start()
    {
        if (joystick == null)
        {
            // try to find it on this gameObject.
            joystick = gameObject.GetComponent <VCAnalogJoystickBase>();
            if (joystick == null)
            {
                VCUtils.DestroyWithError(gameObject, "You must specify a joystick for VCAnalogJoystickPlaymakerUpdater to function.  Destroying this object.");
                return;
            }
        }
    }
Esempio n. 22
0
    // Update is called once per frame
    void Update()
    {
        VCEComponentTool ctool = VCUtils.GetComponentOrOnParent <VCEComponentTool>(this.gameObject);

        if (ctool != null)
        {
            GetComponent <Renderer>().enabled = ctool.m_InEditor;
        }
        else
        {
            GameObject.Destroy(this.gameObject);
        }
    }
Esempio n. 23
0
 void Start()
 {
     if (button == null)
     {
         // try to find it on this gameObject.
         button = gameObject.GetComponent <VCButtonBase>();
         if (button == null)
         {
             VCUtils.DestroyWithError(gameObject, "You must specify a button for VCButtonPlaymakerUpdater to function.  Destroying this object.");
             return;
         }
     }
 }
Esempio n. 24
0
    public static bool NguiEnabled(GameObject go)
    {
        if (typeof(UISprite).GetMember(VCPluginSettings.kFakeMemberName).Length == 0)
        {
            return(true);
        }

        VCUtils.DestroyWithError(go, "An NGUI Virtual Control is being used, but NGUI is not properly enabled!\n" +
                                 "In order to use NGUI, open VCPluginSettings.cs and edit line 82 to #if false.\n" +
                                 "See that file for further instruction.  Destroying this control.");

        return(false);
    }
Esempio n. 25
0
 public void Reset(VCMaterial target)
 {
     ResetMaterial();
     InitMatterList();
     if (m_DiffuseMat == null)
     {
         m_DiffuseMat            = Material.Instantiate(m_UITextureSrcMat) as Material;
         m_DiffuseMapUI.material = m_DiffuseMat;
     }
     if (m_BumpMat == null)
     {
         m_BumpMat            = Material.Instantiate(m_UITextureSrcMat) as Material;
         m_BumpMapUI.material = m_BumpMat;
     }
     m_Target       = target;
     m_TitleUI.text = m_Target == null ? "NEW MATERIAL".ToLocalizationString() : "EDIT MATERIAL".ToLocalizationString();
     m_OKUI.text    = m_Target == null ? "Create".ToLocalizationString() : "Apply".ToLocalizationString();
     if (m_Target != null)
     {
         m_UIDUI.text            = target.GUIDString;
         m_NameUI.text           = target.m_Name;
         m_MatterUI.selection    = VCUtils.Capital(VCConfig.s_Matters[target.m_MatterId].Name, true);
         m_CustomizeUI.isChecked = !target.m_UseDefault;
         QuerySelectedMatter();
         if (!m_CustomizeUI.isChecked)
         {
             SetDefaultProperties();
         }
         else
         {
             SetProperties(target);
         }
     }
     else
     {
         m_UIDUI.text            = "0000000000000000";
         m_CustomizeUI.isChecked = false;
         if (VCEditor.Instance.m_UI.m_MatterPopupList.selection != "All".ToLocalizationString())
         {
             m_MatterUI.selection = VCEditor.Instance.m_UI.m_MatterPopupList.selection;
         }
         else
         {
             m_MatterUI.selection = m_MatterUI.items[0];
         }
         m_NameUI.text = "New Material".ToLocalizationString();
         QuerySelectedMatter();
         SetDefaultProperties();
     }
     Update();
 }
    protected override bool Changed()
    {
        if (!VCUtils.VectorApproximate(m_PositionInput.Vector, m_Data.m_Position, m_PositionInput.m_Format))
        {
            return(true);
        }
        if (!VCUtils.VectorApproximate(m_RotationInput.Vector, m_Data.m_Rotation, m_RotationInput.m_Format))
        {
            return(true);
        }
        if (!VCUtils.VectorApproximate(m_ScaleInput.Vector, new Vector3(m_Data.m_Size, m_Data.m_Size, m_Data.m_Depth), m_ScaleInput.m_Format))
        {
            return(true);
        }
        if (m_MirroredCheck.isChecked != m_Data.m_Mirrored)
        {
            return(true);
        }
        Color32 insc  = m_ColorPicker.FinalColor;
        Color32 datac = m_Data.m_Color;

        if (insc.r != datac.r)
        {
            return(true);
        }
        if (insc.g != datac.g)
        {
            return(true);
        }
        if (insc.b != datac.b)
        {
            return(true);
        }
        if (m_Shader0Check.isChecked && m_Data.m_ShaderIndex != 0)
        {
            return(true);
        }
        if (!m_Shader0Check.isChecked && m_Data.m_ShaderIndex == 0)
        {
            return(true);
        }
        if (m_Shader1Check.isChecked && m_Data.m_ShaderIndex != 1)
        {
            return(true);
        }
        if (!m_Shader1Check.isChecked && m_Data.m_ShaderIndex == 1)
        {
            return(true);
        }
        return(false);
    }
Esempio n. 27
0
    protected override bool Colliding(VCTouchWrapper tw)
    {
        // hit test against a collider if we have one
        if (_collider != null)
        {
            return(AABBContains(tw.position));
        }

        // otherwise, fall back to a rect hit test on the guiTexture
        Rect r = _colliderGuiTexture.GetScreenRect();

        VCUtils.ScaleRect(ref r, hitRectScale);
        return(r.Contains(tw.position));
    }
Esempio n. 28
0
    public static void RPC_S2C_RequestUGCData(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int[] objIDs = stream.Read <int[]>();
        foreach (int id in objIDs)
        {
            CreationData data = CreationMgr.GetCreation(id);
            if (null == data)
            {
                CreationOriginData cData = CreationList.Find(iter => iter.ObjectID == id);
                if (cData != null)
                {
                    CreationMgr.NewCreation(cData.ObjectID, cData.HashCode, (float)cData.Seed);
                }
                else
                {
                    MessageBox_N.ShowOkBox(PELocalization.GetString(8000500));
                    LogManager.Error("Creation item create failed. ID:" + id);
                    GameClientNetwork.Disconnect();
                }

                return;
            }

            ItemProto item = ItemProto.GetItemData(id);
            if (null != item)
            {
                byte[] itemData = ItemProto.GetBuffer(item);
                NetworkManager.SyncServer(EPacketType.PT_Common_UGCItem, id, itemData);

                var components = from component in data.m_IsoData.m_Components
                                 where VCUtils.IsSeat(component.m_Type)
                                 select(int) component.m_Type;

                float hp     = data.m_Attribute.m_Durability;
                float energy = data.m_Attribute.m_MaxFuel;

                if (components.Count() >= 1)
                {
                    NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy,
                                              data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), true,
                                              components.ToArray());
                }
                else
                {
                    NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy,
                                              data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), false);
                }
            }
        }
    }
Esempio n. 29
0
    protected float RangeAdjust(float val, float min, float max)
    {
        float num  = max - min;
        float num2 = Mathf.Abs(val);

        if (num2 < min)
        {
            return(0f);
        }
        if (num2 > max)
        {
            return(1f * VCUtils.GetSign(val));
        }
        return((num2 - min) / num * VCUtils.GetSign(val));
    }
Esempio n. 30
0
 private void Awake()
 {
     base.useGUILayout = false;
     if (VCTouchController.Instance != null)
     {
         VCUtils.DestroyWithError(base.gameObject, "Only one VCTouchController can be in a scene!  Destroying the gameObject with this component.");
         return;
     }
     VCTouchController.Instance = this;
     this.touches = new List <VCTouchWrapper>();
     for (int i = 0; i < 5; i++)
     {
         this.touches.Add(new VCTouchWrapper());
     }
 }