Exemple #1
0
void TypedAnimationClock<T>::OnComputedPropertyValueChanged(PropertyValue* pPropertyVal)
{
	if (pPropertyVal->m_dp == get_CurrentTimeProperty())
	{
		double currentTime = GetPropertyValueDouble(get_CurrentTimeProperty());

		double duration = get_Timeline()->get_Duration();

		SetPropertyValue(get_CurrentProgressProperty(), currentTime / duration);

		SetPropertyValue(get_CurrentValueProperty(), get_Timeline()->GetCurrentValue(NULL, NULL, this));
	}
}
nsresult calIcalComponent::SetIntProperty(icalproperty_kind kind, int32_t i)
{
    icalvalue *val = icalvalue_new_integer(i);
    if (!val)
        return NS_ERROR_OUT_OF_MEMORY;
    return SetPropertyValue(kind, val);
}
UILabelValueTweener::UILabelValueTweener(UIWidget* pParent) : UILabel(pParent)
{
    SetPropertyValue(0);
    SetPropertyDuration(1500);
    SetPropertyRunning(false);
    SetPropertyDelay(0.0f);
    SetPropertyStartTime(0.0f);
}
UILabelValueTweener::UILabelValueTweener() : UILabel()
{
    SetPropertyValue(0);
    SetPropertyDuration(1500);
    SetPropertyRunning(false);
    SetPropertyDelay(0.0f);
    SetPropertyStartTime(0.0f);
}
// Set value
void UILabelValueTweener::SetValue(const int32 nNewValue, const int32 nDurationInMs)
{
    const int32 nCurrent = GetPropertyValue();
    // Save target value
    SetPropertyValue(nNewValue);
    // Start running
    SetPropertyRunning(true);
    // Start tweener
    Start(nCurrent, nNewValue, nDurationInMs, GTTweenInterpolation::Linear, 0.0f);
}
nsresult calIcalComponent::SetStringProperty(icalproperty_kind kind,
                                             const nsACString &str)
{
    icalvalue *val = nullptr;
    if (!str.IsVoid()) {
        val = icalvalue_new_string(PromiseFlatCString(str).get());
        if (!val)
            return NS_ERROR_OUT_OF_MEMORY;
    }
    return SetPropertyValue(kind, val);
}
void UObjectProperty::SetObjectPropertyValue(void* PropertyValueAddress, UObject* Value) const
{
#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
	if (ULinkerPlaceholderExportObject* PlaceholderVal = Cast<ULinkerPlaceholderExportObject>(Value))
	{
		check(PlaceholderVal->IsReferencedBy(this));
	}
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS

	SetPropertyValue(PropertyValueAddress, Value);
}
void UTextProperty::SerializeItem( FArchive& Ar, void* Value, int32 MaxReadBytes, void const* Defaults ) const
{
	const TCppType PropertyValue = GetPropertyValue(Value);
	if ( Ar.IsSaving() && Ar.IsPersistent() && PropertyValue.IsTransient() )
	{
		const FText ErrorMessage = FText::Format( FText::SerializationFailureError, FText::FromString( FTextInspector::GetDisplayString(PropertyValue) ) );
		UE_LOG( LogProperty, Warning, TEXT("%s"), *ErrorMessage.ToString());
		SetPropertyValue(Value, ErrorMessage);
	}

	Ar << *GetPropertyValuePtr(Value);
}
		void SetObjectAt(FArrayHelper* arrayHelper, int32 index, UObject* item)
		{
			// UClass (need to check first since UClassProperty is derived from UObjectProperty)
			{
				auto prop = Cast<UClassProperty>(arrayHelper->GetElementProperty());
				if (prop)
				{
					prop->SetPropertyValue(
						arrayHelper->GetRawPtr(index), Cast<UClass>(item)
					);
					return;
				}
			}
			// UObject
			{
				auto prop = Cast<UObjectProperty>(arrayHelper->GetElementProperty());
				if (prop)
				{
					prop->SetPropertyValue(arrayHelper->GetRawPtr(index), item);
					return;
				}
			}
		}
		void SetStringAt(FArrayHelper* arrayHelper, int32 index, const TCHAR* item)
		{
			// FString
			{
				auto prop = Cast<UStrProperty>(arrayHelper->GetElementProperty());
				if (prop)
				{
					prop->SetPropertyValue(arrayHelper->GetRawPtr(index), FString(item));
					return;
				}
			}
			// FName
			{
				auto prop = Cast<UNameProperty>(arrayHelper->GetElementProperty());
				if (prop)
				{
					prop->SetPropertyValue(arrayHelper->GetRawPtr(index), FName(item));
					return;
				}
			}
			// couldn't convert the string to the array element type
			check(false);
		}
Exemple #11
0
	uint32 CPropertyDB::CreateRow(std::initializer_list<TPropertyValue> _lPropertyValues)
	{
		// We do not currently support DB resizing
		assert(_lPropertyValues.size() <= GetNumProperties());

		uint32 uNewRowIndex   = CreateRow();
		uint32 uPropertyIndex = 0;
		BOOST_FOREACH(const TPropertyValue& _PropertyValue, _lPropertyValues)
		{
			SetPropertyValue(uNewRowIndex, uPropertyIndex, _PropertyValue);
			std::cout << _PropertyValue << std::endl;

			++uPropertyIndex;
		}
void sysSetPropertyValue(char *filename, wchar_t *pszPropertyName, char *value)
{
	wchar_t pszFileName[1024];
	memset(pszFileName, 0, sizeof(pszFileName));
	int len = strlen(filename);
	assert(len < 1024);
	MultiByteToWideChar(CP_OEMCP, 0, filename, len, pszFileName, sizeof(pszFileName));

	wchar_t pszValue[1024];
	memset(pszValue, 0, sizeof(pszValue));
	len = strlen(value);
	assert(len < 1024);
	MultiByteToWideChar(CP_OEMCP, 0, value, len, pszValue, sizeof(pszValue));

	if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)))
	{
		SetPropertyValue(pszFileName, pszPropertyName, pszValue);
		CoUninitialize();
	}
}
Exemple #13
0
bool CMonoEntityExtension::Init(IGameObject *pGameObject)
{
	SetGameObject(pGameObject);

	pGameObject->EnablePhysicsEvent( true, eEPE_OnPostStepImmediate );

	if (!GetGameObject()->BindToNetwork())
		return false;

	IEntity *pEntity = GetEntity();
	IEntityClass *pEntityClass = pEntity->GetClass();

	m_pScript = g_pScriptSystem->InstantiateScript(pEntityClass->GetName(), eScriptFlag_Entity);

	IMonoClass *pEntityInfoClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("EntityInitializationParams", "CryEngine.Native");

	SMonoEntityInfo entityInfo(pEntity);

	IMonoArray *pArgs = CreateMonoArray(1);
	pArgs->InsertMonoObject(pEntityInfoClass->BoxObject(&entityInfo));

	g_pScriptSystem->InitializeScriptInstance(m_pScript, pArgs);
	pArgs->Release();

	int numProperties;
	auto pProperties = static_cast<CEntityPropertyHandler *>(pEntityClass->GetPropertyHandler())->GetQueuedProperties(pEntity->GetId(), numProperties);

	if(pProperties)
	{
		for(int i = 0; i < numProperties; i++)
		{
			auto queuedProperty = pProperties[i];

			SetPropertyValue(queuedProperty.propertyInfo, queuedProperty.value.c_str());
		}
	}

	m_bInitialized = true;

	return true;
}
int NFCPropertyModule::RefreshBaseProperty(const NFGUID& self)
{
    NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_CommPropertyValue());
    if (!pRecord.get())
    {
        return 1;
    }

    //初始属性+等级属性(职业决定)
    NFJobType eJobType = (NFJobType)m_pKernelModule->GetPropertyInt(self, NFrame::Player::Job());
    int nLevel = m_pKernelModule->GetPropertyInt(self, NFrame::Player::Level());

    for (int i = 0; i < pRecord->GetCols(); ++i)
    {
        const std::string& strColTag = pRecord->GetColTag(i);
        int nValue = m_pPropertyConfigModule->CalculateBaseValue(eJobType, nLevel, strColTag);
        SetPropertyValue(self, strColTag, NFPropertyGroup::NPG_JOBLEVEL, nValue);
    }

    return 1;
}
void UILabelValueTweener::TweenUpdate(void)
{
    bool bStop = m_Tweener.GetPropertyElapsedTime() >= m_Tweener.GetPropertyDuration();
    // Calculate new position
    const int32 nNewValue = m_Tweener.Update(TimeManager::GetInstance()->GetDeltaTime());
    UILabel::SetTextFromINT32(nNewValue);

    if(bStop)
    {
        // Callback
        //m_StaticCallback.Execute();
        //(this->*m_pOnCompletion)(NULL);
        //m_pOnCompletion = NULL;
        // Restore the position with its parent
        //m_pGameObject->SetPosition(m_pGameObject->m_pParent->GetPosition());

        // Stop running
        Stop();
        // Save the lastest value
        SetPropertyValue(nNewValue);
    }
}
Exemple #16
0
uint32_t set_property( CAMHandle hCam, uint32_t property,
                       char* value, uint32_t datatype)
{
    uint32_t    rtn = 0;
    uint32_t    data;
    char *      ptr;
    char *      pBuf = 0;
    CAMPropertyValue cam;

do {
    cam.DataType = datatype;
    cam.cntValue = 1;
    cam.Value    = (char*)&data;

    if (datatype == CAM_TYPE_STR) {
        cam.Value = value;
        break;
    }

    if (datatype == CAM_TYPE_AINT8 || datatype == CAM_TYPE_AUINT8) {
        uint32_t    ctr;
        uint32_t *  p32;

        cam.cntValue = strlen( value);
        if (cam.cntValue == 0) {
            cam.Value = 0;
            break;
        }
        cam.cntValue++;

        pBuf = malloc( cam.cntValue * sizeof(uint32_t));
        if (!pBuf) {
            rtn = CAMERR_MALLOC;
            break;
        }
        memset( pBuf, 0, cam.cntValue * sizeof(uint32_t));

        for (ctr = 0, p32 = (uint32_t*)pBuf; ctr < cam.cntValue; ctr++)
            *p32++ = (uint32_t)*value++;

        cam.Value = pBuf;
        break;
    }

    // avoid interpreting value as octal
    for (ptr = value; *ptr == '0'; )
        ptr++;
    if (ptr != value && (*ptr == 'x' || *ptr == 'X'))
        ptr--;

    if (datatype == CAM_TYPE_INT8 || datatype == CAM_TYPE_INT16 ||
                                     datatype == CAM_TYPE_INT32) {
        data = (uint32_t)strtol( ptr, 0, 0);
        break;
    }

    if (datatype == CAM_TYPE_UINT8 || datatype == CAM_TYPE_UINT16 ||
                                      datatype == CAM_TYPE_UINT32) {
        data = strtoul( ptr, 0, 0);
        break;
    }

    rtn = CAMERR_BADPARM;

} while (0);

    if (!rtn)
        rtn = SetPropertyValue( hCam, property, &cam);

    if (pBuf)
        free( pBuf);

    return rtn;
}
int wmain(int argc, wchar_t* argv[])
{
    if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)))
    {
        PCWSTR pszAppName = CONSUME_NEXT_ARG(argv, argc);
        PCWSTR pszOp = CONSUME_NEXT_ARG(argv, argc);
        if (pszOp && ((pszOp[0] == L'-') || (pszOp[0] == L'/')))
        {
            /* skip - or / */
            pszOp++;
            if (!_wcsicmp(pszOp, L"?"))
            {
                Usage(pszAppName);
            }
            else if (!_wcsicmp(pszOp, L"get"))
            {
                PCWSTR pszPropertyName = CONSUME_NEXT_ARG(argv, argc);
                if (pszPropertyName)
                {
                    PCWSTR pszFileName = CONSUME_NEXT_ARG(argv, argc);
                    if (pszFileName)
                    {
                        GetPropertyValue(pszFileName, pszPropertyName);
                    }
                    else
                    {
                        wprintf(L"No file name specified.\n");
                    }
                }
                else
                {
                    wprintf(L"No property canonical name specified.\n");
                }
            }
            else if (!_wcsicmp(pszOp, L"enum"))
            {
                PCWSTR pszFileName = CONSUME_NEXT_ARG(argv, argc);
                if (pszFileName)
                {
                    EnumerateProperties(pszFileName);
                }
                else
                {
                    wprintf(L"No file name specified.\n");
                }
            }
            else if (!_wcsicmp(pszOp, L"set"))
            {
                PCWSTR pszPropertyName = CONSUME_NEXT_ARG(argv, argc);
                if (pszPropertyName)
                {
                    PCWSTR pszPropertyValue = CONSUME_NEXT_ARG(argv, argc);
                    if (pszPropertyValue)
                    {
                        PCWSTR pszFileName = CONSUME_NEXT_ARG(argv, argc);
                        if (pszFileName)
                        {
                            SetPropertyValue(pszFileName, pszPropertyName, pszPropertyValue);
                        }
                        else
                        {
                            wprintf(L"No file name specified.\n");
                        }
                    }
                    else
                    {
                        wprintf(L"No property value specified.\n");
                    }
                }
                else
                {
                    wprintf(L"No property canonical name specified.\n");
                }
            }
            else if (!_wcsicmp(pszOp, L"info"))
            {
                PCWSTR pszPropertyName = CONSUME_NEXT_ARG(argv, argc);
                if (pszPropertyName)
                {
                    GetPropertyDescription(pszPropertyName);
                }
                else
                {
                    wprintf(L"No property canonical name specified.\n");
                }
            }
            else
            {
                wprintf(L"Unrecognized operation specified: -%s\n", pszOp);
                Usage(pszAppName);
            }
        }
        else
        {
            wprintf(L"No operation specified.\n");
            Usage(pszAppName);
        }
        CoUninitialize();
    }
    return 0;
}