Пример #1
0
        public void AddConductor(ConductorMF _conductorMF, ConnectorLabel _connectorLabel, ConductorCableHandle.HandleSide _handleSide)  
        {
            // check if it exists
            //if (connectorDict.ContainsKey(_connectorLabel)) return;

            connectorDict.Add(_connectorLabel, new ConductorInfo(_conductorMF, _handleSide));

            var props = new Value();

            props["Scene Name"] = SceneManager.GetActiveScene().name;
            Mixpanel.Track("Add Handle", props);
        }
Пример #2
0
        public void RemoveConductor(ConnectorLabel _connectorLabel)
        {
            // stop if it doesn't exist
            if (!connectorDict.ContainsKey(_connectorLabel))
            {
                return;
            }

            connectorDict.Remove(_connectorLabel);

            var props = new Value();

            props["Scene Name"] = SceneManager.GetActiveScene().name;
            Mixpanel.Track("Remove Handle", props);
        }
Пример #3
0
        // checks if this ConductorMF is addable
        public string IsAddable(ConductorMF _conductorMF, ConnectorLabel _connectorLabel, ConductorCableHandle.HandleSide _handleSide)
        {
            // check if key exists
            if (connectorDict.ContainsKey(_connectorLabel))
            {
                return("error");
            }

            // if other handleside is already attached, see if it's on the same connector pair
            switch (_connectorLabel)
            {
            case ConnectorLabel.DC_A_POS:
                if (connectorDict.ContainsKey(ConnectorLabel.DC_A_NEG))
                {
                    if (connectorDict[ConnectorLabel.DC_A_NEG].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.DC_A_NEG:
                if (connectorDict.ContainsKey(ConnectorLabel.DC_A_POS))
                {
                    if (connectorDict[ConnectorLabel.DC_A_POS].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.DC_B_POS:
                if (connectorDict.ContainsKey(ConnectorLabel.DC_B_NEG))
                {
                    if (connectorDict[ConnectorLabel.DC_B_NEG].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.DC_B_NEG:
                if (connectorDict.ContainsKey(ConnectorLabel.DC_B_POS))
                {
                    if (connectorDict[ConnectorLabel.DC_B_POS].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.AC_A1:
                if (connectorDict.ContainsKey(ConnectorLabel.AC_A2))
                {
                    if (connectorDict[ConnectorLabel.AC_A2].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.AC_A2:
                if (connectorDict.ContainsKey(ConnectorLabel.AC_A1))
                {
                    if (connectorDict[ConnectorLabel.AC_A1].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.AC_B1:
                if (connectorDict.ContainsKey(ConnectorLabel.AC_B2))
                {
                    if (connectorDict[ConnectorLabel.AC_B2].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;

            case ConnectorLabel.AC_B2:
                if (connectorDict.ContainsKey(ConnectorLabel.AC_B1))
                {
                    if (connectorDict[ConnectorLabel.AC_B1].conductorMF != _conductorMF)
                    {
                        return("errorWrongPair");
                    }
                }
                break;
            }

            // if another conductor is connected, make sure to only connect same current type
            switch (_connectorLabel)
            {
            case ConnectorLabel.DC_A_POS:
            case ConnectorLabel.DC_A_NEG:
            case ConnectorLabel.DC_B_POS:
            case ConnectorLabel.DC_B_NEG:
                if (connectorDict.ContainsKey(ConnectorLabel.AC_A1))
                {
                    return("errorOnlyDC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.AC_A2))
                {
                    return("errorOnlyDC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.AC_B1))
                {
                    return("errorOnlyDC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.AC_B2))
                {
                    return("errorOnlyDC");
                }
                break;

            case ConnectorLabel.AC_A1:
            case ConnectorLabel.AC_A2:
            case ConnectorLabel.AC_B1:
            case ConnectorLabel.AC_B2:
                if (connectorDict.ContainsKey(ConnectorLabel.DC_A_POS))
                {
                    return("errorOnlyAC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.DC_A_NEG))
                {
                    return("errorOnlyAC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.DC_B_POS))
                {
                    return("errorOnlyAC");
                }
                if (connectorDict.ContainsKey(ConnectorLabel.DC_B_NEG))
                {
                    return("errorOnlyAC");
                }
                break;
            }

            return("success");
        }